* Note max write size if GUESTFS_MAX_CHUNK_SIZE.
*/
extern int send_file_write (const void *buf, int len);
-extern void send_file_end (int cancel);
+extern int send_file_end (int cancel);
/* only call this if there is a FileOut parameter */
extern void reply (xdrproc_t xdrp, char *ret);
return 1;
}
-void
+int
send_file_end (int cancel)
{
guestfs_chunk chunk;
chunk.cancel = cancel;
chunk.data.data_len = 0;
chunk.data.data_val = NULL;
- send_chunk (&chunk);
+ return send_chunk (&chunk);
}
static int
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");
+ exit (1);
+ }
- return 0;
+ return err;
}
return -1;
}
- send_file_end (0); /* Normal end of file. */
+ if (send_file_end (0)) /* Normal end of file. */
+ return -1;
+
return 0;
}
return -1;
}
- send_file_end (0); /* Normal end of file. */
+ if (send_file_end (0)) /* Normal end of file. */
+ return -1;
+
return 0;
}