>From 83d52a061db9350bf97cd7c8c49d727b7e931662 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Tue, 3 Jun 2014 10:50:09 +0100 Subject: [PATCH] true: always exit with status 0 even if can't write * src/true.c (main): Init exit_failure appropriately. * tests/misc/false-status.sh: Fix so we're testing the tool and not the shell builtin. Add a case for true also. --- src/true.c | 1 + tests/misc/false-status.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/true.c b/src/true.c index 219f98c..4ac319b 100644 --- a/src/true.c +++ b/src/true.c @@ -64,6 +64,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + initialize_exit_failure (EXIT_STATUS); atexit (close_stdout); if (STREQ (argv[1], "--help")) diff --git a/tests/misc/false-status.sh b/tests/misc/false-status.sh index b943040..9be6892 100755 --- a/tests/misc/false-status.sh +++ b/tests/misc/false-status.sh @@ -1,5 +1,6 @@ #!/bin/sh # ensure that false exits nonzero even with --help or --version +# and vice versa for true # Copyright (C) 2003-2014 Free Software Foundation, Inc. @@ -19,7 +20,12 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ false -false --version > /dev/null && fail=1 -false --help > /dev/null && fail=1 +env false --version > /dev/null && fail=1 +env false --help > /dev/null && fail=1 + +if test -w /dev/full && test -c /dev/full; then + env true --version > /dev/full || fail=1 + env true --help > /dev/full || fail=1 +fi Exit $fail -- 1.7.7.6