diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2024-05-24 15:51:54 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2024-05-24 15:51:54 (GMT) |
| commit | 2e2a5ff346f7091433d5deefdf922c2ecb183efd (patch) | |
| tree | 1a2ba085a298383bdf0ce62478ed760c1a458180 | |
| parent | e1f594e502c1bf3ef39b9871fbe801d3278e559c (diff) | |
| parent | 26d88985bd21932bc679f523a245cebfcc8516aa (diff) | |
| download | tcl-2e2a5ff346f7091433d5deefdf922c2ecb183efd.zip tcl-2e2a5ff346f7091433d5deefdf922c2ecb183efd.tar.gz tcl-2e2a5ff346f7091433d5deefdf922c2ecb183efd.tar.bz2 | |
Fix [e589d9bdab] - fconfigure socket -peername
| -rw-r--r-- | tests/socket.test | 19 | ||||
| -rw-r--r-- | win/tclWinSock.c | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/socket.test b/tests/socket.test index b628404..2f71d7b 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -1110,6 +1110,25 @@ test socket_$af-7.5 {testing socket specific options} -setup { close $s close $s1 } -result [list $localhost 1 3] +test socket_$af-7.6 {testing socket specific options - bug e589d9bdab} -setup { + set timer [after 10000 "set x timed_out"] + set l "" +} -constraints [list socket supported_$af unixOrWin] -body { + set s [socket -server accept 0] + proc accept {s a p} { + global x + set x [fconfigure $s -sockname] + close $s + } + set listen [lindex [fconfigure $s -sockname] 2] + set s1 [socket $localhost $listen] + vwait x + lsort [dict keys [fconfigure $s1]] +} -cleanup { + after cancel $timer + close $s + close $s1 +} -result {-blocking -buffering -buffersize -encoding -eofchar -keepalive -nodelay -peername -profile -sockname -translation} test socket_$af-8.1 {testing -async flag on sockets} -constraints [list socket supported_$af] -body { # NOTE: This test may fail on some Solaris 2.4 systems. If it does, check diff --git a/win/tclWinSock.c b/win/tclWinSock.c index a202726..f783b1b 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1381,7 +1381,7 @@ TcpGetOptionProc( reverseDNS = NI_NUMERICHOST; } - if (HAVE_OPTION("-peername")) { + if ((len == 0) || HAVE_OPTION("-peername")) { address peername; socklen_t size = sizeof(peername); |
