On principle, we shouldn't ignore write failure:
From 56317a61bc22e935dc750cf669a164bacc12cf12 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 20 Aug 2009 12:29:46 +0200 Subject: [PATCH libguestfs] daemon: diagnose socket write failure
* daemon/proto.c (send_chunk): Don't ignore socket-write error. --- daemon/proto.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon/proto.c b/daemon/proto.c index 9b33902..c2dd50c 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -495,8 +495,10 @@ send_chunk (const guestfs_chunk *chunk) xdr_uint32_t (&xdr, &len); xdr_destroy (&xdr); - (void) xwrite (sock, lenbuf, 4); - (void) xwrite (sock, buf, len); + int err = (xwrite (sock, lenbuf, 4) == 0 + && xwrite (sock, buf, len) == 0 ? 0 : -1); + if (err) + fprintf (stderr, "send_chunk: write failed\n"); - return 0; + return err; } -- 1.6.4.378.g88f2f