Ho hum - forgot timeout case.
authorJeremy Allison <jra@samba.org>
Wed, 10 May 2000 18:53:03 +0000 (18:53 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 10 May 2000 18:53:03 +0000 (18:53 +0000)
Jeremy.
(This used to be commit 597ecd724e0d4ac7c19eb9fb85b3c9910bbfb114)

source3/libsmb/nmblib.c

index f8f38fe44d3af6d7508b813a1b92931e6bc46163..d4955fa6a62d9da549d6848868516dda47f164b5 100644 (file)
@@ -960,18 +960,22 @@ struct packet_struct *receive_packet(int fd,enum packet_type type,int t)
 {
        fd_set fds;
        struct timeval timeout;
+       int ret;
 
        FD_ZERO(&fds);
        FD_SET(fd,&fds);
        timeout.tv_sec = t/1000;
        timeout.tv_usec = 1000*(t%1000);
 
-       if (sys_select(fd+1,&fds,&timeout) == -1) {
+       if ((ret = sys_select(fd+1,&fds,&timeout)) == -1) {
                /* errno should be EBADF or EINVAL. */
                DEBUG(0,("select returned -1, errno = %s (%d)\n", strerror(errno), errno));
                return NULL;
        }
 
+       if (ret == 0) /* timeout */
+               return NULL;
+
        if (FD_ISSET(fd,&fds)) 
                return(read_packet(fd,type));