diff options
author | James Youngman <jay@gnu.org> | 2008-04-06 11:45:57 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2008-04-08 01:42:36 +0200 |
commit | bb98388557c7e68067b103c6654baa6a1614b392 (patch) | |
tree | c539b0924bc852ec04bb9e19dc0045abaee0b38d | |
parent | 8ce2449daf5d846a50ecc9342f929998524baa86 (diff) | |
download | util-linux-old-bb98388557c7e68067b103c6654baa6a1614b392.tar.gz |
fsck.minix: correct the error message given when we can't open the device
Don't actually print %s in the error message, print the device name,
as was obviously intended. Also, print the error message
corresponding to the errno value.
[kzak@redhat.com: add __attribute__, coding style cleanups]
Signed-off-by: James Youngman <jay@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | disk-utils/fsck.minix.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index cd41d795..bbe80b42 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -86,6 +86,7 @@ */ #include <stdio.h> +#include <stdarg.h> #include <errno.h> #include <unistd.h> #include <string.h> @@ -188,9 +189,18 @@ usage(void) { leave(16); } +static void die(const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + static void -die(const char *str) { - fprintf(stderr, "%s: %s\n", program_name, str); +die(const char *fmt, ...) { + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end (ap); + fputc('\n', stderr); leave(8); } @@ -1283,7 +1293,7 @@ main(int argc, char ** argv) { } IN = open(device_name,repair?O_RDWR:O_RDONLY); if (IN < 0) - die(_("unable to open '%s'")); + die(_("unable to open '%s': %s"), device_name, strerror(errno)); for (count=0 ; count<3 ; count++) sync(); read_superblock(); |