1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-26 20:12:56 +00:00

when UNIX-LISTEN was applied to an existing file it failed as expected but removed the file

This commit is contained in:
Gerhard Rieger 2010-10-03 16:28:06 +02:00
parent 4c3d1ca49d
commit cb913fbc0c
4 changed files with 51 additions and 15 deletions

32
test.sh
View file

@ -10297,7 +10297,37 @@ fi # NUMCOND
;;
esac
N=$((N+1))
set +vx
# test if socat keeps an existing file where it wanted to create a UNIX socket
NAME=UNIXLISTEN_KEEPFILE
case "$TESTS" in
*%functions%*|*%bugs%*|*%unix%*|*%socket%*|*%$NAME%*)
TEST="$NAME: socat keeps an existing file where it wanted to create a UNIX socket"
# we create a file and start socat with UNIX-LISTEN on this file. expected
# behaviour: socat exits immediately with error, but keeps the file
# up to 1.7.1.3, it removed the file
if ! eval $NUMCOND; then :; else
tf="$td/test$N.file"
te="$td/test$N.stderr"
CMD0="$SOCAT $opts -u UNIX-LISTEN:$tf /dev/null"
printf "test $F_n $TEST... " $N
rm -f "$tf"; touch "$tf"
$CMD0 >/dev/null 2>"${te}0"
rc0=$?
if [ $rc0 -ne 0 -a -f "$tf" ]; then
$PRINTF "$OK\n"
numOK=$((numOK+1))
else
$PRINTF "$FAILED\n"
echo "$CMD0"
cat "${te}0"
numFAIL=$((numFAIL+1))
fi
fi # NUMCOND
;;
esac
N=$((N+1))
###############################################################################