[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] daemon: grub: show grub-install's output on error if verbose



---
 daemon/grub.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/daemon/grub.c b/daemon/grub.c
index c058599..9596d7a 100644
--- a/daemon/grub.c
+++ b/daemon/grub.c
@@ -38,16 +38,19 @@ int
 do_grub_install (const char *root, const char *device)
 {
   int r;
-  CLEANUP_FREE char *err = NULL, *buf = NULL;
+  CLEANUP_FREE char *err = NULL, *buf = NULL, *out = NULL;
 
   if (asprintf_nowarn (&buf, "--root-directory=%R", root) == -1) {
     reply_with_perror ("asprintf");
     return -1;
   }
 
-  r = command (NULL, &err, str_grub_install, buf, device, NULL);
+  r = command (verbose ? &out : NULL, &err,
+               str_grub_install, buf, device, NULL);
 
   if (r == -1) {
+    if (verbose)
+      fprintf (stderr, "grub output:\n%s\n", out);
     reply_with_error ("%s", err);
     return -1;
   }
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]