summaryrefslogtreecommitdiffstats
path: root/text-utils/display.c
diff options
context:
space:
mode:
authorSami Kerola2013-09-08 18:09:09 +0200
committerKarel Zak2013-09-10 12:57:31 +0200
commit4ccf1137046d3f28bf2f2781a095ecd225294fd8 (patch)
treee1284eff2f74cdcb29e08e5718f4bae029744c5b /text-utils/display.c
parenttools: generate autotools files if missing (diff)
downloadkernel-qcow2-util-linux-4ccf1137046d3f28bf2f2781a095ecd225294fd8.tar.gz
kernel-qcow2-util-linux-4ccf1137046d3f28bf2f2781a095ecd225294fd8.tar.xz
kernel-qcow2-util-linux-4ccf1137046d3f28bf2f2781a095ecd225294fd8.zip
hexdump: revert global exitval variable change
The change f2a037fb7b153954d5d34cca48182b6d8832fcfa had unfavorable effect of making hexdump to return non-zero exit value always. This happen because oversight when 'exitval' gets to be set. By clance, one might expect main() to call next() which will return value for 'exitval'. That assessment misses later call chain main() -> display() -> get() -> next(), which in reverse should return correct value for 'exitval'. It was mentioned in util-linux maillist that Ondrej Oprala is working on major renewal of the hexdump . That in mind it seems best to simply to revert the global 'exitval' and avoid conflict with Ondrej's work. Reference: http://markmail.org/message/sbnvuhkboreujj5p Reported-by: Dave Reisner <d@falconindy.com> CC: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'text-utils/display.c')
-rw-r--r--text-utils/display.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/text-utils/display.c b/text-utils/display.c
index 41ddd8db5..1f9a11b4c 100644
--- a/text-utils/display.c
+++ b/text-utils/display.c
@@ -295,7 +295,7 @@ get(void)
int next(char **argv)
{
static int done;
- int statok, exitval = 0;
+ int statok;
if (argv) {
_argv = argv;
@@ -305,14 +305,14 @@ int next(char **argv)
if (*_argv) {
if (!(freopen(*_argv, "r", stdin))) {
warn("%s", *_argv);
- exitval = 1;
+ exitval = EXIT_FAILURE;
++_argv;
continue;
}
statok = done = 1;
} else {
if (done++)
- return(exitval);
+ return(0);
statok = 0;
}
if (skip)