Re: bug report: select on unconnected sockets

john slee (indigoid@higherplane.net)
Sun, 1 Apr 2001 02:15:24 +1000


On Sat, Mar 31, 2001 at 06:44:20PM +0300, Radu Greab wrote:
> Sorry if this is already known: on a RH 7.0 system with kernel 2.4.2
> or 2.4.3, a select on an unconnected socket incorrectly says that the
> socket is ready for input and output. Of course, reading from the socket
> file descriptor returns -1 and errno is set to ENOTCONN as shown in
> the strace output:
>
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
> select(4, [3], [3], [3], {0, 0}) = 2 (in [3], out [3], left {0, 0})
> read(3, 0xbffff668, 1024) = -1 ENOTCONN (Transport endpoint is not connected)
>
> I attached a small example program to reproduce the bug.

bleah. which one is supposed to be right?

linux 2.4
---------
$ uname -a
Linux XXXXX 2.4.2-ac20 #8 Wed Mar 14 01:53:05 EST 2001 i686 unknown
$ ./t
select result=2
read: Transport endpoint is not connected

linux 2.2
---------
$ uname -a
Linux XXXXX 2.2.18 #1 Thu Dec 21 21:13:10 EST 2000 i586 unknown
$ ./t
select result=1

solaris
-------
$ uname -a
SunOS XXXXX 5.7 Generic_106541-07 sun4m sparc sun4m
$ ./t
select result=0

-- 
"Bobby, jiggle Grandpa's rat so it looks alive, please" -- gary larson
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/