git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e65e1d5
)
Carefully check return values from xwrite.
author
Richard Jones
<rjones@redhat.com>
Sun, 26 Apr 2009 08:51:30 +0000
(09:51 +0100)
committer
Richard Jones
<rjones@redhat.com>
Sun, 26 Apr 2009 08:51:30 +0000
(09:51 +0100)
daemon/proto.c
patch
|
blob
|
history
diff --git
a/daemon/proto.c
b/daemon/proto.c
index
becf27c
..
ffb4a4e
100644
(file)
--- a/
daemon/proto.c
+++ b/
daemon/proto.c
@@
-79,6
+79,7
@@
main_loop (int _sock)
xread (sock, buf, len);
xread (sock, buf, len);
+#if 0
if (verbose) {
int i, j;
if (verbose) {
int i, j;
@@
-99,6
+100,7
@@
main_loop (int _sock)
printf ("|\n");
}
}
printf ("|\n");
}
}
+#endif
/* Decode the message header. */
xdrmem_create (&xdr, buf, len, XDR_DECODE);
/* 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);
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
}
void
@@
-250,8
+258,14
@@
reply (xdrproc_t xdrp, char *ret)
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
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'. */
}
/* Receive file chunks, repeatedly calling 'cb'. */