1234567891011121314151617181920212223242526272829303132333435363738 |
- find_fds() {
- fds=""
- for f in /proc/self/fd/*; do
- test "$f" = "/proc/self/fd/0" && continue
- test "$f" = "/proc/self/fd/1" && continue
- test "$f" = "/proc/self/fd/2" && continue
- fds="$fds ${f##*/}>&-"
- done
- }
- find_fds
- fds1="$fds"
- eval "find_fds $fds"
- find_fds
- test x"$fds1" = x"$fds" \
- && { echo "Ok: script fd is not closed"; exit 0; }
- test x"$fds1" = x" 10>&- 3>&-" && \
- test x"$fds" = x" 11>&- 3>&-" \
- && { echo "Ok: script fd is not closed"; exit 0; }
- test x"$fds1" = x" 3>&- 4>&-" && \
- test x"$fds" = x" 10>&- 3>&-" \
- && { echo "Ok: script fd is not closed"; exit 0; }
- echo "Bug: script fd is closed"
- echo "fds1:$fds1"
- echo "fds2:$fds"
- exit 1
|