summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-06-26 13:36:19 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-06-28 09:39:00 +0100
commitd2cbbcc782a1164a2dd3b1d8601a1798ae4077a9 (patch)
treefd91013cebb7cd98664c81f4e9179df4c24fcd46
parent6fc3349d5f83fccf85508ba8e1bb8635173d2328 (diff)
downloadlibguestfs-d2cbbcc782a1164a2dd3b1d8601a1798ae4077a9.tar.gz
libguestfs-d2cbbcc782a1164a2dd3b1d8601a1798ae4077a9.tar.xz
libguestfs-d2cbbcc782a1164a2dd3b1d8601a1798ae4077a9.zip
launch: Ensure errno from test_qemu_cmd is captured and printed.
(cherry picked from commit 9e221e55b61e9f1cd0caf292ca609a4ca26f1d4d)
-rw-r--r--src/launch.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/launch.c b/src/launch.c
index 52966317..f756af8b 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -1350,8 +1350,8 @@ test_qemu (guestfs_h *g)
* probably indicates that the qemu binary is missing.
*/
if (test_qemu_cmd (g, cmd, &g->qemu_help) == -1) {
- error (g, _("command failed: %s\n\nIf qemu is located on a non-standard path, try setting the LIBGUESTFS_QEMU\nenvironment variable. There may also be errors printed above."),
- cmd);
+ error (g, _("command failed: %s\nerrno: %s\n\nIf qemu is located on a non-standard path, try setting the LIBGUESTFS_QEMU\nenvironment variable. There may also be errors printed above."),
+ cmd, strerror (errno));
return -1;
}
@@ -1400,10 +1400,8 @@ read_all (guestfs_h *g, FILE *fp, char **ret)
*ret = safe_realloc (g, *ret, n + BUFSIZ);
p = &(*ret)[n];
r = fread (p, 1, BUFSIZ, fp);
- if (ferror (fp)) {
- perrorf (g, "read");
+ if (ferror (fp))
return -1;
- }
n += r;
goto again;
}