Patchwork [09/10] block: print errno on error

login
register
mail settings
Submitter Juan Quintela
Date March 4, 2010, 9 a.m.
Message ID <5fd84f921f650fac8af52e0606350280a5558d92.1267692963.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/46898/
State New
Headers show

Comments

Juan Quintela - March 4, 2010, 9 a.m.
Now that we changed all create calls to return errno, just print it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 qemu-img.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 0c9f2d4..e51b40c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -374,7 +374,7 @@  static int img_create(int argc, char **argv)
         } else if (ret == -EFBIG) {
             error("The image size is too large for file format '%s'", fmt);
         } else {
-            error("Error while formatting");
+            error("%s: error while creating %s: %s", filename, fmt, strerror(-ret));
         }
     }
     return 0;
@@ -687,7 +687,7 @@  static int img_convert(int argc, char **argv)
         } else if (ret == -EFBIG) {
             error("The image size is too large for file format '%s'", out_fmt);
         } else {
-            error("Error while formatting '%s'", out_filename);
+            error("%s: error while converting %s: %s", out_filename, out_fmt, strerror(-ret));
         }
     }