git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
appliance: Add xfsprogs to list of packages
[libguestfs.git]
/
daemon
/
proto.c
diff --git
a/daemon/proto.c
b/daemon/proto.c
index
d03a048
..
a0d3736
100644
(file)
--- a/
daemon/proto.c
+++ b/
daemon/proto.c
@@
-24,11
+24,13
@@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
-#include <ctype.h>
#include <sys/param.h> /* defines MIN */
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <sys/param.h> /* defines MIN */
#include <rpc/types.h>
#include <rpc/xdr.h>
+#include "c-ctype.h"
+#include "ignore-value.h"
+
#include "daemon.h"
#include "../src/guestfs_protocol.h"
#include "daemon.h"
#include "../src/guestfs_protocol.h"
@@
-53,16
+55,16
@@
main_loop (int _sock)
sock = _sock;
for (;;) {
sock = _sock;
for (;;) {
-#if 0
/* Most common errors are leaked memory and leaked file descriptors,
* so run this between each command:
*/
/* 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. */
/* 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);
xdrmem_create (&xdr, lenbuf, 4, XDR_DECODE);
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
@@
-79,7
+81,8
@@
main_loop (int _sock)
continue;
}
continue;
}
- xread (sock, buf, len);
+ if (xread (sock, buf, len) == -1)
+ exit (1);
#ifdef ENABLE_PACKET_DUMP
if (verbose) {
#ifdef ENABLE_PACKET_DUMP
if (verbose) {
@@
-93,7
+96,7
@@
main_loop (int _sock)
printf (" ");
printf ("|");
for (j = i; j < MIN (i+16, len); ++j)
printf (" ");
printf ("|");
for (j = i; j < MIN (i+16, len); ++j)
- if (isprint (buf[j]))
+ if (
c_
isprint (buf[j]))
printf ("%c", buf[j]);
else
printf (".");
printf ("%c", buf[j]);
else
printf (".");
@@
-307,7
+310,9
@@
receive_file (receive_cb cb, void *opaque)
for (;;) {
/* Read the length word. */
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);
xdrmem_create (&xdr, lenbuf, 4, XDR_DECODE);
xdr_uint32_t (&xdr, &len);
xdr_destroy (&xdr);
@@
-327,7
+332,8
@@
receive_file (receive_cb cb, void *opaque)
return -1;
}
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);
xdrmem_create (&xdr, buf, len, XDR_DECODE);
memset (&chunk, 0, sizeof chunk);
@@
-444,10
+450,8
@@
check_for_library_cancellation (void)
/* Read the message from the daemon. */
r = xread (sock, buf, sizeof buf);
/* Read the message from the daemon. */
r = xread (sock, buf, sizeof buf);
- if (r == -1) {
- perror ("read");
+ if (r == -1)
return 0;
return 0;
- }
xdrmem_create (&xdr, buf, sizeof buf, XDR_DECODE);
xdr_uint32_t (&xdr, &flag);
xdrmem_create (&xdr, buf, sizeof buf, XDR_DECODE);
xdr_uint32_t (&xdr, &flag);