- [ -z "$pid" ] && return 1 # not running at all
- count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l` # 3rd: count all it's worth
- [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
- && return # success -- release
+ if [ ! -z "$pid" ]; then
+ count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l` # 3rd: count all it's worth
+ [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
+ && return # success -- release
+ fi