diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-06-25 00:59:14 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-06-25 00:59:14 +0000 |
commit | de532c83339bcf70c4f6222203fe7b1991bf6926 (patch) | |
tree | c8250e8831f3ebb8b9594e3f31aae9d0e3d97adc /source3/lib | |
parent | 0c7925e4293c6ed7852c5fde2ba3376ada49f494 (diff) | |
download | samba-de532c83339bcf70c4f6222203fe7b1991bf6926.tar.gz samba-de532c83339bcf70c4f6222203fe7b1991bf6926.tar.bz2 samba-de532c83339bcf70c4f6222203fe7b1991bf6926.zip |
fixed a bug in handling select in the main daemon - this stops the daemon spinning if a signal is received at an inconvenient moment
(This used to be commit d8d7dd523d897ea25a572c8f21903e94e8485404)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/select.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/source3/lib/select.c b/source3/lib/select.c index efcf63becc..f88ad52de6 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -102,6 +102,12 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s } if (FD_ISSET(select_pipe[0], readfds2)) { + char c; + saved_errno = errno; + if (read(select_pipe[0], &c, 1) == 1) { + pipe_read++; + } + errno = saved_errno; FD_CLR(select_pipe[0], readfds2); ret--; if (ret == 0) { @@ -110,18 +116,6 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s } } - saved_errno = errno; - - while (pipe_written != pipe_read) { - char c; - /* Due to the linux kernel bug in 2.0.x, we - * always increment here even if the read failed... */ - read(select_pipe[0], &c, 1); - pipe_read++; - } - - errno = saved_errno; - return ret; } |