summaryrefslogtreecommitdiff
path: root/tests/tail-2
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-03-26 00:36:01 +0000
committerPádraig Brady <P@draigBrady.com>2013-04-04 03:01:48 +0100
commit7abf99e1907b1b05cb45eacaa98bfa73efe0ab92 (patch)
tree5fa68cc019b4c74f61b9c4843ce04715d389adcb /tests/tail-2
parentf7867e73caac82349e5623d04e46aaf784778644 (diff)
downloadcoreutils-7abf99e1907b1b05cb45eacaa98bfa73efe0ab92.tar.xz
tail: exit without reading input if would never output
* src/tail.c (main): If -n0 or -c0 were specified without -f, then no data would ever be output, so exit without reading input. * tests/tail-2/tail-n0f.sh: Augment the related test with this case.
Diffstat (limited to 'tests/tail-2')
-rwxr-xr-xtests/tail-2/tail-n0f.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/tail-2/tail-n0f.sh b/tests/tail-2/tail-n0f.sh
index a8d375978..1c6ba89eb 100755
--- a/tests/tail-2/tail-n0f.sh
+++ b/tests/tail-2/tail-n0f.sh
@@ -29,6 +29,11 @@ require_proc_pid_status_
touch empty || framework_failure_
echo anything > nonempty || framework_failure_
+# First verify that -[nc]0 without -f, exit without reading
+touch unreadable || framework_failure_
+chmod 0 unreadable || framework_failure_
+tail -c0 unreadable || fail=1
+tail -n0 unreadable || fail=1
for inotify in ---disable-inotify ''; do
for file in empty nonempty; do