diff --git a/CHANGES b/CHANGES index 17e2a78..5413114 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,9 @@ corrections: connections with option connect-timeout fail when the connections succeeded. Thanks to Bruno De Fraine for reporting this bug. + option end-close "did not apply" to addresses PTY, SOCKET-CONNECT, + and most UNIX-* and ABSTRACT-* + half close of EXEC and SYSTEM addresses did not work for pipes and sometimes socketpair diff --git a/VERSION b/VERSION index b433f70..179d9ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -"1.7.0.0+execshut+connecttimeout+segvonaccept" +"1.7.0.0+execshut+connecttimeout+segvonaccept+endclose" diff --git a/test.sh b/test.sh index a9b974d..5e366b6 100755 --- a/test.sh +++ b/test.sh @@ -7527,6 +7527,37 @@ esac N=$((N+1)) +# up to 1.7.0.0 option end-close led to an error with some address types due to +# bad internal handling. here we check it for address PTY +NAME=PTYENDCLOSE +case "$TESTS" in +*%functions%*|*%bugs%*|*%pty%*|*%$NAME%*) +TEST="$NAME: PTY handles option end-close" +# with the bug, socat exits with error. we invoke socat in a no-op mode and +# check its return status. +if ! eval $NUMCOND; then :; + else +tf="$td/test$N.stout" +te="$td/test$N.stderr" +CMD="$SOCAT $opts /dev/null pty,end-close" +printf "test $F_n $TEST... " $N +$CMD 2>"${te}" +rc=$? +if [ "$rc" = 0 ]; then + $PRINTF "$OK\n" + numOK=$((numOK+1)) +else + $PRINTF "$FAILED\n" + echo "$CMD" + cat "${te}" + numFAIL=$((numFAIL+1)) +fi +fi # NUMCOND + ;; +esac +N=$((N+1)) + + NAME=UDP6LISTENBIND # this tests for a bug in (up to) 1.5.0.0: # with udp*-listen, the bind option supported only IPv4 diff --git a/xio-pty.c b/xio-pty.c index 290f676..1f7d7d3 100644 --- a/xio-pty.c +++ b/xio-pty.c @@ -1,5 +1,5 @@ /* source: xio-pty.c */ -/* Copyright Gerhard Rieger 2002-2008 */ +/* Copyright Gerhard Rieger 2002-2009 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for creating pty addresses */ @@ -49,8 +49,8 @@ static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xiofl xfd->stream.howtoend = END_CLOSE; - applyopts(-1, opts, PH_INIT); if (applyopts_single(&xfd->stream, opts, PH_INIT) < 0) return -1; + applyopts(-1, opts, PH_INIT); retropt_bool(opts, OPT_UNLINK_CLOSE, &opt_unlink_close); @@ -82,8 +82,8 @@ static int xioopen_pty(int argc, const char *argv[], struct opt *opts, int xiofl retropt_timespec(opts, OPT_PTY_INTERVALL, &pollintv); #endif /* HAVE_POLL */ - applyopts2(-1, opts, PH_INIT, PH_EARLY); if (applyopts_single(&xfd->stream, opts, PH_INIT) < 0) return -1; + applyopts2(-1, opts, PH_INIT, PH_EARLY); applyopts(-1, opts, PH_PREBIGEN); diff --git a/xio-socket.c b/xio-socket.c index d35a165..e8139a0 100644 --- a/xio-socket.c +++ b/xio-socket.c @@ -237,8 +237,8 @@ int xioopen_socket_connect(int argc, const char *argv[], struct opt *opts, /*retropt_int(opts, OPT_IP_PROTOCOL, &proto);*/ xfd->howtoend = END_SHUTDOWN; - applyopts(-1, opts, PH_INIT); if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1; + applyopts(-1, opts, PH_INIT); applyopts(-1, opts, PH_EARLY); themlen = 0; diff --git a/xio-unix.c b/xio-unix.c index e3c7d78..e45a3fa 100644 --- a/xio-unix.c +++ b/xio-unix.c @@ -1,5 +1,5 @@ /* source: xio-unix.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2009 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for opening addresses of UNIX socket type */ @@ -155,6 +155,7 @@ static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, i } } + if (applyopts_single(xfd, opts, PH_INIT) < 0) return STAT_NORETRY; applyopts(-1, opts, PH_INIT); applyopts(-1, opts, PH_EARLY); @@ -227,8 +228,8 @@ static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts, xfd->opt_unlink_close = true; } - applyopts(-1, opts, PH_INIT); if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1; + applyopts(-1, opts, PH_INIT); applyopts(-1, opts, PH_EARLY); if ((result = @@ -290,8 +291,8 @@ static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, i xfd->opt_unlink_close = true; } - applyopts(-1, opts, PH_INIT); if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1; + applyopts(-1, opts, PH_INIT); return _xioopen_dgram_sendto(needbind?&us:NULL, uslen, @@ -463,8 +464,8 @@ _xioopen_unix_client(xiosingle_t *xfd, int xioflags, unsigned groups, struct opt *opts0; int result; - applyopts(-1, opts, PH_INIT); if (applyopts_single(xfd, opts, PH_INIT) < 0) return -1; + applyopts(-1, opts, PH_INIT); xfd->howtoend = END_SHUTDOWN; retropt_socket_pf(opts, &pf);