summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/posix/readdir_error.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/posix/readdir_error.sh b/tests/posix/readdir_error.sh
new file mode 100644
index 0000000..cca71f0
--- /dev/null
+++ b/tests/posix/readdir_error.sh
@@ -0,0 +1,21 @@
+clean_scratch
+mkfifo scratch/{pid,hup}
+
+(
+ # Create a zombie process
+ echo >/dev/null &
+ # Write the PID to scratch/pid
+ echo $! >scratch/pid
+ # Don't wait on the processes
+ exec cat scratch/hup >/dev/null
+) &
+
+# Kill cat on exit
+trap "echo >scratch/hup" EXIT
+
+# Read the zombie PID
+read -r pid <scratch/pid
+
+# On Linux, open(/proc/$pid/net) will succeed but readdir() will fail
+skip_unless test -r "/proc/$pid/net"
+fail invoke_bfs "/proc/$pid/net" >/dev/null