Don't attempt to write to sockets represented as files

Fixes #54.
This commit is contained in:
Chris Down 2017-10-29 10:40:38 +00:00
parent 35a3cb2e8a
commit f576a116fd

View file

@ -14,7 +14,10 @@ lock_timeout=2
xsel_log=/dev/null xsel_log=/dev/null
for file in /proc/self/fd/2 /dev/stderr; do for file in /proc/self/fd/2 /dev/stderr; do
[[ -e "$file" ]] || continue [[ -f "$file" ]] || continue
# In Linux, it's not possible to write to a socket represented by a file
# (for example, /dev/stderr or /proc/self/fd/2). See issue #54.
[[ -f "$(readlink "$file")" ]] || continue
xsel_log="$file" xsel_log="$file"
break break
done done