Implement _send_sync, _send_file_sync and _receive_file_sync.
[libguestfs.git] / daemon / proto.c
index 131c66b..76dce98 100644 (file)
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <ctype.h>
+#include <sys/param.h>         /* defines MIN */
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
@@ -34,7 +35,7 @@
 /* XXX We should make this configurable from /proc/cmdline so that the
  * verbose setting of the guestfs_h can be inherited here.
  */
-#define DEBUG 1
+#define DEBUG 0
 
 /* The message currently being processed. */
 int proc_nr;
@@ -78,8 +79,6 @@ main_loop (int _sock)
 #if DEBUG
     int i, j;
 
-#define MIN(a,b) ((a)<(b)?(a):(b))
-
     for (i = 0; i < len; i += 16) {
       printf ("%04x: ", i);
       for (j = i; j < MIN (i+16, len); ++j)
@@ -193,7 +192,7 @@ send_error (const char *msg)
     exit (1);
   }
 
-  err.error = (char *) msg;
+  err.error_message = (char *) msg;
 
   if (!xdr_guestfs_message_error (&xdr, &err)) {
     fprintf (stderr, "guestfsd: failed to encode error message body\n");
@@ -207,8 +206,8 @@ send_error (const char *msg)
   xdr_uint32_t (&xdr, &len);
   xdr_destroy (&xdr);
 
-  xwrite (sock, lenbuf, 4);
-  xwrite (sock, buf, len);
+  (void) xwrite (sock, lenbuf, 4);
+  (void) xwrite (sock, buf, len);
 }
 
 void
@@ -248,6 +247,6 @@ reply (xdrproc_t xdrp, char *ret)
   xdr_uint32_t (&xdr, &len);
   xdr_destroy (&xdr);
 
-  xwrite (sock, lenbuf, 4);
-  xwrite (sock, buf, len);
+  (void) xwrite (sock, lenbuf, 4);
+  (void) xwrite (sock, buf, len);
 }