#include <rpc/types.h>
#include <rpc/xdr.h>
+#include "ignore-value.h"
+
#include "daemon.h"
#include "../src/guestfs_protocol.h"
sock = _sock;
for (;;) {
-#if 0
/* Most common errors are leaked memory and leaked file descriptors,
* so run this between each command:
*/
- if (verbose)
- system ("ls -l /proc/self/fd");
-#endif
+ if (verbose && 0)
+ ignore_value (system ("ls -l /proc/self/fd"));
/* Read the length word. */
- xread (sock, lenbuf, 4);
+ if (xread (sock, lenbuf, 4) == -1)
+ exit (1);
+
xdrmem_create (&xdr, lenbuf, 4, XDR_DECODE);
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
continue;
}
- xread (sock, buf, len);
+ if (xread (sock, buf, len) == -1)
+ exit (1);
#ifdef ENABLE_PACKET_DUMP
if (verbose) {
for (;;) {
/* Read the length word. */
- xread (sock, lenbuf, 4);
+ if (xread (sock, lenbuf, 4) == -1)
+ exit (1);
+
xdrmem_create (&xdr, lenbuf, 4, XDR_DECODE);
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
return -1;
}
- xread (sock, buf, len);
+ if (xread (sock, buf, len) == -1)
+ exit (1);
xdrmem_create (&xdr, buf, len, XDR_DECODE);
memset (&chunk, 0, sizeof chunk);
/* Read the message from the daemon. */
r = xread (sock, buf, sizeof buf);
- if (r == -1) {
- perror ("read");
+ if (r == -1)
return 0;
- }
xdrmem_create (&xdr, buf, sizeof buf, XDR_DECODE);
xdr_uint32_t (&xdr, &flag);