summaryrefslogtreecommitdiffstats
path: root/tests/posix/readdir_error.sh
blob: cca71f03eedfa47b993dd50d286b6a147f360ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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