summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorJames Youngman2008-04-06 12:45:57 +0200
committerKarel Zak2008-04-08 01:42:36 +0200
commitbb98388557c7e68067b103c6654baa6a1614b392 (patch)
treec539b0924bc852ec04bb9e19dc0045abaee0b38d /disk-utils
parentmount: remove built-in support for background mounts (diff)
downloadkernel-qcow2-util-linux-bb98388557c7e68067b103c6654baa6a1614b392.tar.gz
kernel-qcow2-util-linux-bb98388557c7e68067b103c6654baa6a1614b392.tar.xz
kernel-qcow2-util-linux-bb98388557c7e68067b103c6654baa6a1614b392.zip
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>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/fsck.minix.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index cd41d7950..bbe80b42e 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();