From: Ian Jackson Date: Wed, 3 Nov 2010 11:58:25 +0000 (+0000) Subject: tools: gdbsx: Check return of write() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11294 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=02bac862c003b2da5bb5c396e3ca19a7fb6990ea;p=xen.git 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 Signed-off-by: Ian Jackson --- diff --git a/tools/debugger/gdbsx/gx/gx_comm.c b/tools/debugger/gdbsx/gx/gx_comm.c index 156a9f5f55..ed4a7bef0e 100644 --- a/tools/debugger/gdbsx/gx/gx_comm.c +++ b/tools/debugger/gdbsx/gx/gx_comm.c @@ -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");