[PATCH] Correct the error message given when we can't open the device. | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
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.
---
disk-utils/fsck.minix.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index cd41d79..4953663 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>
@@ -189,9 +190,15 @@ usage(void) {
}
static void
-die(const char *str) {
- fprintf(stderr, "%s: %s\n", program_name, str);
- leave(8);
+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 +1290,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();
--
1.5.3.8
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Site Home] [Netdev] [Ethernet Bridging] [Linux Wireless] [Kernel Newbies] [Memory] [Security] [Linux for Hams] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux Admin] [Samba] [Video 4 Linux] [Linux Resources]