Pino Toscano
2016-Mar-02 10:05 UTC
[Libguestfs] [PATCH] make-fs: print error message on mkfs failure
This makes a bit easier to diagnose failures on mkfs, without the need
to restart the filesystem creation with verbose output (which will
produce a lot more output).
---
make-fs/make-fs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c
index ff291a1..561c6ae 100644
--- a/make-fs/make-fs.c
+++ b/make-fs/make-fs.c
@@ -773,8 +773,8 @@ do_make_fs (const char *input, const char *output_str)
if (r == -1) {
/* Provide more guidance in the error message (RHBZ#823883). */
- fprintf (stderr, "%s: 'mkfs' (create filesystem) operation
failed.\n",
- guestfs_int_program_name);
+ fprintf (stderr, "%s: 'mkfs' (create filesystem) operation
failed: %s\n",
+ guestfs_int_program_name, guestfs_last_error (g));
if (STREQ (type, "fat"))
fprintf (stderr, "Instead of 'fat', try 'vfat'
(long filenames) or 'msdos' (short filenames).\n");
else
--
2.5.0
Richard W.M. Jones
2016-Mar-02 12:04 UTC
Re: [Libguestfs] [PATCH] make-fs: print error message on mkfs failure
On Wed, Mar 02, 2016 at 11:05:19AM +0100, Pino Toscano wrote:> This makes a bit easier to diagnose failures on mkfs, without the need > to restart the filesystem creation with verbose output (which will > produce a lot more output). > --- > make-fs/make-fs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c > index ff291a1..561c6ae 100644 > --- a/make-fs/make-fs.c > +++ b/make-fs/make-fs.c > @@ -773,8 +773,8 @@ do_make_fs (const char *input, const char *output_str) > > if (r == -1) { > /* Provide more guidance in the error message (RHBZ#823883). */ > - fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed.\n", > - guestfs_int_program_name); > + fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed: %s\n", > + guestfs_int_program_name, guestfs_last_error (g)); > if (STREQ (type, "fat")) > fprintf (stderr, "Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).\n"); > elseACK this patch and the previous patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Possibly Parallel Threads
- [PATCH] format, make-fs: specify the label on mkfs
- [PATCH 0/1] virt-make-fs: add '--blocksize' option support
- [PATCH 1/1] virt-make-fs: add '--blocksize' option support
- [PATCH 0/3] Use gnulib's getprogname
- [PATCH v2] virt-make-fs: add '--blocksize' option support