summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0c92c58)
* daemon/proto.c (send_chunk): Don't ignore socket-write error.
* daemon/proto.c (send_file_end): Return "int", not void,
so we can propagate send_chunk failure to caller.
* daemon/daemon.h (send_file_end): Update prototype.
* daemon/tar.c (do_tar_out, do_tgz_out): Update uses of send_file_end.
* daemon/upload.c (do_download): Likewise.
* Note max write size if GUESTFS_MAX_CHUNK_SIZE.
*/
extern int send_file_write (const void *buf, int len);
* 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);
/* only call this if there is a FileOut parameter */
extern void reply (xdrproc_t xdrp, char *ret);
send_file_end (int cancel)
{
guestfs_chunk chunk;
send_file_end (int cancel)
{
guestfs_chunk chunk;
chunk.cancel = cancel;
chunk.data.data_len = 0;
chunk.data.data_val = NULL;
chunk.cancel = cancel;
chunk.data.data_len = 0;
chunk.data.data_val = NULL;
+ return send_chunk (&chunk);
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);
+ 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);
+ }
- send_file_end (0); /* Normal end of file. */
+ if (send_file_end (0)) /* Normal end of file. */
+ return -1;
+
- send_file_end (0); /* Normal end of file. */
+ if (send_file_end (0)) /* Normal end of file. */
+ return -1;
+
- send_file_end (0); /* Normal end of file. */
+ if (send_file_end (0)) /* Normal end of file. */
+ return -1;
+