aboutsummaryrefslogtreecommitdiff
path: root/coreutils/printenv.c
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-11-11 22:59:41 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-11-11 22:59:41 +0000
commitf91f14d2211148ade28270572b9c45023f9b6580 (patch)
tree8b8d9060a9f5c68694f494a4bcbfce9338dc1c65 /coreutils/printenv.c
parent0d8736772d3dda40852c552edfbc649a3494d2fa (diff)
downloadbusybox-f91f14d2211148ade28270572b9c45023f9b6580.tar.gz
busybox-f91f14d2211148ade28270572b9c45023f9b6580.tar.bz2
cksum, printenv: report errors via exitcode
function old new delta cksum_main 296 315 +19 printenv_main 74 86 +12
Diffstat (limited to 'coreutils/printenv.c')
-rw-r--r--coreutils/printenv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index 6971f7258..2430f3a1a 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -13,6 +13,8 @@
int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int printenv_main(int argc UNUSED_PARAM, char **argv)
{
+ int exit_code = EXIT_SUCCESS;
+
/* no variables specified, show whole env */
if (!argv[1]) {
int e = 0;
@@ -26,8 +28,10 @@ int printenv_main(int argc UNUSED_PARAM, char **argv)
env = getenv(arg);
if (env)
puts(env);
+ else
+ exit_code = EXIT_FAILURE;
}
}
- fflush_stdout_and_exit(EXIT_SUCCESS);
+ fflush_stdout_and_exit(exit_code);
}