diff options
author | Sami Kerola | 2012-06-16 22:30:04 +0200 |
---|---|---|
committer | Sami Kerola | 2012-06-17 17:59:59 +0200 |
commit | 3c44e03f8cb77572911a7bf2ecbcbb3e0c27a4fc (patch) | |
tree | 06bfa773ba06cdee083af6df4812c66468828c94 /text-utils | |
parent | mount: (new) use exclusive_option() (diff) | |
download | kernel-qcow2-util-linux-3c44e03f8cb77572911a7bf2ecbcbb3e0c27a4fc.tar.gz kernel-qcow2-util-linux-3c44e03f8cb77572911a7bf2ecbcbb3e0c27a4fc.tar.xz kernel-qcow2-util-linux-3c44e03f8cb77572911a7bf2ecbcbb3e0c27a4fc.zip |
hexdump: print sensible message when all input file arguments fail
Earlier hexdump printed unnecessary, and perhaps even misleading, 'bad
file descriptor' message.
$ hexdump foobar
hexdump: foobar: No such file or directory
hexdump: foobar: Bad file descriptor
The message is changed to
$ hexdump foobar
hexdump: foobar: No such file or directory
hexdump: all input file arguments failed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'text-utils')
-rw-r--r-- | text-utils/display.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/text-utils/display.c b/text-utils/display.c index 717565ed1..1f9a11b4c 100644 --- a/text-utils/display.c +++ b/text-utils/display.c @@ -42,6 +42,7 @@ #include "hexdump.h" #include "xalloc.h" #include "c.h" +#include "nls.h" static void doskip(const char *, int); static u_char *get(void); @@ -257,6 +258,10 @@ get(void) eaddress = address + nread; return(curp); } + if (fileno(stdin) == -1) { + warnx(_("all input file arguments failed")); + return(NULL); + } n = fread((char *)curp + nread, sizeof(unsigned char), length == -1 ? need : min(length, need), stdin); if (!n) { |