summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivano@gnu.org>2009-07-02 23:40:40 +0200
committerJim Meyering <meyering@redhat.com>2009-07-03 17:52:30 +0200
commitd106277d458fc65f521165248e3e8cd4eb41a5f6 (patch)
treefeb5991e4a8f3819e5c166d6fea781cfa16b9b82
parent962878499cf09453fd08bbf57fbecd75994971d4 (diff)
downloadcoreutils-d106277d458fc65f521165248e3e8cd4eb41a5f6.tar.xz
tests: tail-2/wait: don't fail when run as root
* tests/tail-2/wait: Ensure that the unreadable file really is not readable before trying to run "tail -f" on it.
-rwxr-xr-xtests/tail-2/wait25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/tail-2/wait b/tests/tail-2/wait
index 7eee8b159..8f2f6107f 100755
--- a/tests/tail-2/wait
+++ b/tests/tail-2/wait
@@ -45,17 +45,20 @@ if test -n "$state"; then
kill $pid
fi
-tail -s0.1 -f not_accessible &
-pid=$!
-sleep .5
-state=$(get_process_status_ $pid)
-
-if test -n "$state"; then
- case $state in
- S*) echo $0: process still active 1>&2; fail=1 ;;
- *) ;;
- esac
- kill $pid
+# Check if the file is really not accessible before use it.
+if ! cat not_accessible; then
+ tail -s0.1 -f not_accessible &
+ pid=$!
+ sleep .5
+ state=$(get_process_status_ $pid)
+
+ if test -n "$state"; then
+ case $state in
+ S*) echo $0: process still active 1>&2; fail=1 ;;
+ *) ;;
+ esac
+ kill $pid
+ fi
fi
(tail -s0.1 -f here 2>tail.err) &