X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fproto.c;h=ffb4a4e8db3301f26b0907b4253276deda2fd456;hb=697f50aea8638fc9f5d1a250de6c1b9f4697500e;hp=becf27c3d88ac728254953dd587b4105bbb8f0c2;hpb=2069ade88144d8efd272a74be24b5c9ff49844dc;p=libguestfs.git diff --git a/daemon/proto.c b/daemon/proto.c index becf27c..ffb4a4e 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -79,6 +79,7 @@ main_loop (int _sock) xread (sock, buf, len); +#if 0 if (verbose) { int i, j; @@ -99,6 +100,7 @@ main_loop (int _sock) printf ("|\n"); } } +#endif /* Decode the message header. */ xdrmem_create (&xdr, buf, len, XDR_DECODE); @@ -209,8 +211,14 @@ send_error (const char *msg) xdr_uint32_t (&xdr, &len); xdr_destroy (&xdr); - (void) xwrite (sock, lenbuf, 4); - (void) xwrite (sock, buf, len); + if (xwrite (sock, lenbuf, 4) == -1) { + fprintf (stderr, "xwrite failed\n"); + exit (1); + } + if (xwrite (sock, buf, len) == -1) { + fprintf (stderr, "xwrite failed\n"); + exit (1); + } } void @@ -250,8 +258,14 @@ reply (xdrproc_t xdrp, char *ret) xdr_uint32_t (&xdr, &len); xdr_destroy (&xdr); - (void) xwrite (sock, lenbuf, 4); - (void) xwrite (sock, buf, len); + if (xwrite (sock, lenbuf, 4) == -1) { + fprintf (stderr, "xwrite failed\n"); + exit (1); + } + if (xwrite (sock, buf, len) == len) { + fprintf (stderr, "xwrite failed\n"); + exit (1); + } } /* Receive file chunks, repeatedly calling 'cb'. */