1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-19 12:23:49 +03:00

Ho hum - forgot timeout case.

Jeremy.
This commit is contained in:
Jeremy Allison
-
parent a9c4371a2d
commit 597ecd724e

View File

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