public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PROBLEM: select() says closed socket readable
@ 2001-08-18  3:28 Jay Rogers
  2001-08-18 16:27 ` kuznet
  0 siblings, 1 reply; 15+ messages in thread
From: Jay Rogers @ 2001-08-18  3:28 UTC (permalink / raw)
  To: linux-kernel

For linux 2.4.2, select() indicates socket ready for read on a
socket that's never been connected.  This is inconsistent with
other versions of Unix including Linux 2.2.

The following program demonstrates:

    #include <stdio.h>
    #include <unistd.h>
    #include <sys/time.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    
    main(int argc, char *argv[])
    {
        fd_set rfds;
        int retval;
        int sock;
        struct timeval tv;
    
        sock = socket(AF_INET, SOCK_STREAM, 0);
        if (sock == -1) abort();
    
        FD_ZERO(&rfds);
        FD_SET(sock, &rfds);
        tv.tv_sec = 0;
        tv.tv_usec = 0;
    
        retval = select(sock + 1, &rfds, NULL, NULL, &tv);
        printf("retval from select(): %d\n", retval);
    
        exit(0);
    } /* end main program */

Output from "ver_linux" follows:

Linux costarica 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
 
Gnu C                  2.96
Gnu make               3.79.1
binutils               2.10.91.0.2
util-linux             2.10r
modutils               2.4.2
e2fsprogs              1.19
reiserfsprogs          3.x.0f
pcmcia-cs              3.1.22
PPP                    2.4.0
Linux C Library        2.2.2
Dynamic linker (ldd)   2.2.2
Procps                 2.0.7
Net-tools              1.57
Console-tools          0.3.3
Sh-utils               2.0
Modules Loaded         nfs lockd sunrpc nls_iso8859-1 ide-cd cdrom autofs 3c59x ipchains usb-uhci usbcore

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2001-08-23 10:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-18  3:28 PROBLEM: select() says closed socket readable Jay Rogers
2001-08-18 16:27 ` kuznet
2001-08-18 22:52   ` Ton Hospel
2001-08-20 14:34   ` Jay Rogers
2001-08-20 15:03     ` David S. Miller
2001-08-20 15:29       ` Udo A. Steinberg
2001-08-21  9:02       ` Mike Jagdis
2001-08-21 17:35         ` David Schwartz
2001-08-21 18:38           ` Alan Cox
2001-08-21 19:01             ` David Schwartz
2001-08-22  9:26           ` Mike Jagdis
2001-08-22 21:40             ` David Schwartz
2001-08-23 10:30               ` Mike Jagdis
2001-08-23 10:56               ` [PATCH] " Mike Jagdis
2001-08-20 19:48     ` PROBLEM: " David Schwartz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox