From: Richard W.M. Jones Date: Tue, 7 Jun 2011 11:36:02 +0000 (+0100) Subject: protocol: Enhance "unexpected end of file when reading from daemon" error. X-Git-Tag: 1.8.8~15 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=d83c866ca3a13a072077f3388716dbb037b85ce2;p=libguestfs.git protocol: Enhance "unexpected end of file when reading from daemon" error. Make this error more informative, since it is a common error when the appliance fails to start up. (cherry picked from commit 2f73ea343cc4a3433f20e99a7835152767a70f80) --- diff --git a/src/proto.c b/src/proto.c index 125c126..490dcfd 100644 --- a/src/proto.c +++ b/src/proto.c @@ -459,6 +459,25 @@ guestfs___send_to_daemon (guestfs_h *g, const void *v_buf, size_t n) * will not see GUESTFS_PROGRESS_FLAG. */ +static inline void +unexpected_end_of_file_from_daemon_error (guestfs_h *g) +{ +#define UNEXPEOF_ERROR "unexpected end of file when reading from daemon.\n" +#define UNEXPEOF_TEST_TOOL \ + "Or you can run 'libguestfs-test-tool' and post the complete output into\n" \ + "a bug report or message to the libguestfs mailing list." + if (!g->verbose) + error (g, _(UNEXPEOF_ERROR +"This usually means the libguestfs appliance failed to start up. Please\n" +"enable debugging (LIBGUESTFS_DEBUG=1) and rerun the command, then look at\n" +"the debug messages output prior to this error.\n" +UNEXPEOF_TEST_TOOL)); + else + error (g, _(UNEXPEOF_ERROR +"See earlier debug messages.\n" +UNEXPEOF_TEST_TOOL)); +} + int guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) { @@ -527,7 +546,7 @@ guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) return -1; } if (r == 0) { - error (g, _("unexpected end of file when reading from daemon")); + unexpected_end_of_file_from_daemon_error (g); child_cleanup (g); return -1; } @@ -588,7 +607,7 @@ guestfs___recv_from_daemon (guestfs_h *g, uint32_t *size_rtn, void **buf_rtn) return -1; } if (r == 0) { - error (g, _("unexpected end of file when reading from daemon")); + unexpected_end_of_file_from_daemon_error (g); child_cleanup (g); free (*buf_rtn); *buf_rtn = NULL;