[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1289230777 0
# Node ID 31602ac2b5fa80af1669cbab5863baf8a50acd8d
# Parent  5c8057e8f9af3ff4ba01c2151f3c2bb2d461c363
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>
xen-unstable changeset:   22349:3f98881703aa
xen-unstable date:        Wed Nov 03 11:58:25 2010 +0000
---
 tools/debugger/gdbsx/gx/gx_comm.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r 5c8057e8f9af -r 31602ac2b5fa tools/debugger/gdbsx/gx/gx_comm.c
--- a/tools/debugger/gdbsx/gx/gx_comm.c Mon Nov 08 15:36:58 2010 +0000
+++ b/tools/debugger/gdbsx/gx/gx_comm.c Mon Nov 08 15:39:37 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.