mirror of
https://repo.or.cz/socat.git
synced 2024-12-23 07:52:32 +00:00
exec:...,pty did not kill child process under some circumstances
This commit is contained in:
parent
79b6e800c6
commit
26134dff53
4 changed files with 60 additions and 3 deletions
4
CHANGES
4
CHANGES
|
@ -5,6 +5,10 @@ new features:
|
||||||
docu source doc/socat.yo released
|
docu source doc/socat.yo released
|
||||||
|
|
||||||
corrections:
|
corrections:
|
||||||
|
exec:...,pty did not kill child process under some circumstances; fixed
|
||||||
|
by correcting typo in xio-progcall.c (problem reported by
|
||||||
|
Ralph Forsythe)
|
||||||
|
|
||||||
corrected some print statements and variable names
|
corrected some print statements and variable names
|
||||||
|
|
||||||
make uninstall did not uninstall procan
|
make uninstall did not uninstall procan
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
"1.6.0.0+"
|
"1.6.0.0+execpty"
|
||||||
|
|
52
test.sh
52
test.sh
|
@ -7796,6 +7796,58 @@ fi
|
||||||
esac
|
esac
|
||||||
N=$((N+1))
|
N=$((N+1))
|
||||||
|
|
||||||
|
|
||||||
|
# test: there was a bug with exec:...,pty that did not kill the exec'd sub
|
||||||
|
# process under some circumstances.
|
||||||
|
NAME=EXECPTYKILL
|
||||||
|
case "$TESTS" in
|
||||||
|
*%functions%*|*%bugs%*|*%exec%*|*%$NAME%*)
|
||||||
|
TEST="$NAME: exec:...,pty explicitely kills sub process"
|
||||||
|
# we want to check if the exec'd sub process is kill in time
|
||||||
|
# for this we have a shell script that generates a file after two seconds;
|
||||||
|
# it should be killed after one second, so if the file was generated the test
|
||||||
|
# has failed
|
||||||
|
tf="$td/test$N.stdout"
|
||||||
|
te="$td/test$N.stderr"
|
||||||
|
ts="$td/test$N.sock"
|
||||||
|
tda="$td/test$N.data"
|
||||||
|
tsh="$td/test$N.sh"
|
||||||
|
tdiff="$td/test$N.diff"
|
||||||
|
cat >"$tsh" <<EOF
|
||||||
|
sleep 1; echo; sleep 1; touch "$tda"; echo
|
||||||
|
EOF
|
||||||
|
chmod a+x "$tsh"
|
||||||
|
CMD1="$SOCAT $opts -U UNIX-LISTEN:$ts,fork EXEC:$tsh,pty"
|
||||||
|
CMD="$SOCAT $opts /dev/null UNIX-CONNECT:$ts"
|
||||||
|
printf "test $F_n $TEST... " $N
|
||||||
|
$CMD1 2>"${te}2" &
|
||||||
|
pid1=$!
|
||||||
|
sleep 1
|
||||||
|
waitfile $ts 1
|
||||||
|
$CMD 2>>"${te}1" >>"$tf"
|
||||||
|
usleep 2500000
|
||||||
|
kill "$pid1" 2>/dev/null
|
||||||
|
wait
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
$PRINTF "$FAILED: $SOCAT:\n"
|
||||||
|
echo "$CMD1 &"
|
||||||
|
echo "$CMD2"
|
||||||
|
cat "${te}1" "${te}2"
|
||||||
|
numFAIL=$((numFAIL+1))
|
||||||
|
elif [ -f "$tda" ]; then
|
||||||
|
$PRINTF "$FAILED\n"
|
||||||
|
cat "${te}1" "${te}2"
|
||||||
|
numFAIL=$((numFAIL+1))
|
||||||
|
else
|
||||||
|
$PRINTF "$OK\n"
|
||||||
|
if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi
|
||||||
|
numOK=$((numOK+1))
|
||||||
|
fi ;;
|
||||||
|
esac
|
||||||
|
PORT=$((PORT+1))
|
||||||
|
N=$((N+1))
|
||||||
|
|
||||||
|
|
||||||
echo "summary: $((N-1)) tests; $numOK ok, $numFAIL failed, $numCANT could not be performed"
|
echo "summary: $((N-1)) tests; $numOK ok, $numFAIL failed, $numCANT could not be performed"
|
||||||
|
|
||||||
if [ "$numFAIL" -gt 0 ]; then
|
if [ "$numFAIL" -gt 0 ]; then
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* source: xio-progcall.c */
|
/* source: xio-progcall.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2007 */
|
/* Copyright Gerhard Rieger 2001-2008 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains common code dealing with program calls (exec, system) */
|
/* this file contains common code dealing with program calls (exec, system) */
|
||||||
|
@ -283,7 +283,8 @@ int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
applyopts_cloexec(ptyfd, popts);/*!*/
|
applyopts_cloexec(ptyfd, popts);/*!*/
|
||||||
if (fd->howtoend = END_UNSPEC) {
|
/* exec:...,pty did not kill child process under some circumstances */
|
||||||
|
if (fd->howtoend == END_UNSPEC) {
|
||||||
fd->howtoend = END_CLOSE_KILL;
|
fd->howtoend = END_CLOSE_KILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue