summaryrefslogtreecommitdiffstats
path: root/src/proto.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-06-07 12:36:02 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-06-07 12:36:02 +0100
commit2f73ea343cc4a3433f20e99a7835152767a70f80 (patch)
tree3041853b47bab77b5bb642c4b96b07b26d86e76d /src/proto.c
parent9ce239a8365b2209de24f72aa75a7a049ee72d01 (diff)
downloadlibguestfs-2f73ea343cc4a3433f20e99a7835152767a70f80.tar.gz
libguestfs-2f73ea343cc4a3433f20e99a7835152767a70f80.tar.xz
libguestfs-2f73ea343cc4a3433f20e99a7835152767a70f80.zip
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.
Diffstat (limited to 'src/proto.c')
-rw-r--r--src/proto.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/proto.c b/src/proto.c
index 63aea68e..d8b10486 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -531,6 +531,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)
{
@@ -596,7 +615,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;
}
@@ -659,7 +678,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;