diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-09-09 12:06:59 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-09-09 12:06:59 -0400 |
commit | 500892f115aea9788da7649b59baaea38729aacf (patch) | |
tree | b4cdf6a5ad5348ab77e2164d125fc7fc726a04e3 /tests.sh | |
parent | 55470cc8835ef774bf7defa9a4b319c8fa9d2f4b (diff) | |
download | bfs-500892f115aea9788da7649b59baaea38729aacf.tar.xz |
Try /proc/self/fd before /dev/fd
On Solaris, /proc/self/fd is dynamic while /dev/fd is static.
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -510,12 +510,18 @@ function bfs_diff() ( ) function closefrom() { - for fd in /dev/fd/*; do + if [ -d /proc/self/fd ]; then + local fds=/proc/self/fd + else + local fds=/dev/fd + fi + + for fd in "$fds"/*; do if [ ! -e "$fd" ]; then continue fi - fd="${fd##*/}" + local fd="${fd##*/}" if [ "$fd" -ge "$1" ]; then eval "exec ${fd}<&-" fi |