WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools: gdbsx: Check return of write()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: gdbsx: Check return of write()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Nov 2010 16:50:18 -0700
Delivery-date: Thu, 04 Nov 2010 16:51:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1288785505 0
# Node ID 3f98881703aa4c2c0a59a7be67ebca275f9cbe21
# Parent  2dfba250c50bafac4e333d84450324daedf5ae2c
tools: gdbsx: Check return of write()

Not checking leads to warn_unused_result checks triggering in some
libraries and compilers.  Combined with -Werror this breaks the build.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/debugger/gdbsx/gx/gx_comm.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r 2dfba250c50b -r 3f98881703aa tools/debugger/gdbsx/gx/gx_comm.c
--- a/tools/debugger/gdbsx/gx/gx_comm.c Wed Nov 03 08:18:51 2010 +0000
+++ b/tools/debugger/gdbsx/gx/gx_comm.c Wed Nov 03 11:58:25 2010 +0000
@@ -227,13 +227,19 @@ gx_getpkt (char *buf)
         
         gxprt("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
               (c1 << 4) + c2, csum, buf);
-        write(remote_fd, "-", 1);
+        if (write(remote_fd, "-", 1) != 1) {
+            perror("write");
+            return -1;
+        }
     }
     if (gx_remote_dbg) {
         gxprt("getpkt (\"%s\");  [sending ack] \n", buf);
     }
         
-    write(remote_fd, "+", 1);
+    if (write(remote_fd, "+", 1) != 1) {
+        perror("write");
+        return -1;
+    }
         
     if (gx_remote_dbg) {
         gxprt("[sent ack]\n");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools: gdbsx: Check return of write(), Xen patchbot-unstable <=