diff --git a/CHANGES b/CHANGES index 667f5e0..06386f4 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,10 @@ new features: docu source doc/socat.yo released 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 make uninstall did not uninstall procan diff --git a/VERSION b/VERSION index 075b3c7..7e4ee98 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -"1.6.0.0+" +"1.6.0.0+execpty" diff --git a/test.sh b/test.sh index 6a1dd33..19e271d 100755 --- a/test.sh +++ b/test.sh @@ -7796,6 +7796,58 @@ fi esac 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" <"${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" if [ "$numFAIL" -gt 0 ]; then diff --git a/xio-progcall.c b/xio-progcall.c index 3d41893..372afad 100644 --- a/xio-progcall.c +++ b/xio-progcall.c @@ -1,5 +1,5 @@ /* 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 */ /* 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; } 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; }