diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-05-01 14:33:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:05:29 -0500 |
commit | 66a4c270d49bc3807b547ff17423b9d661eb3983 (patch) | |
tree | 67ed383e0c3f9e6b035010bbfe9226385de3a171 /source4/lib/replace | |
parent | a4a2a4b833e7738db2282b3e5a37bc59fc0983dc (diff) | |
download | samba-66a4c270d49bc3807b547ff17423b9d661eb3983.tar.gz samba-66a4c270d49bc3807b547ff17423b9d661eb3983.tar.bz2 samba-66a4c270d49bc3807b547ff17423b9d661eb3983.zip |
r15377: Remove sys_select() code as it's no longer used.
(This used to be commit 68004f68a364ce826ed8cbed0977e631ca60594d)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r-- | source4/lib/replace/readline.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/source4/lib/replace/readline.c b/source4/lib/replace/readline.c index 52f45eb759..78febf5000 100644 --- a/source4/lib/replace/readline.c +++ b/source4/lib/replace/readline.c @@ -25,6 +25,51 @@ #include <unistd.h> #include "system/readline.h" +/******************************************************************* + Similar to sys_select() but catch EINTR and continue. + This is what sys_select() used to do in Samba. +********************************************************************/ + +int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval) +{ + int ret; + fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2, errorfds_buf; + struct timeval tval2, *ptval; + + readfds2 = (readfds ? &readfds_buf : NULL); + writefds2 = (writefds ? &writefds_buf : NULL); + errorfds2 = (errorfds ? &errorfds_buf : NULL); + ptval = (tval ? &tval2 : NULL); + + do { + if (readfds) + readfds_buf = *readfds; + if (writefds) + writefds_buf = *writefds; + if (errorfds) + errorfds_buf = *errorfds; + if (tval) + tval2 = *tval; + + /* We must use select and not sys_select here. If we use + sys_select we'd lose the fact a signal occurred when sys_select + read a byte from the pipe. Fix from Mark Weaver + <mark-clist@npsl.co.uk> + */ + + ret = select(maxfd, readfds2, writefds2, errorfds2, ptval); + } while (ret == -1 && errno == EINTR); + + if (readfds) + *readfds = readfds_buf; + if (writefds) + *writefds = writefds_buf; + if (errorfds) + *errorfds = errorfds_buf; + + return ret; +} + /**************************************************************************** Display the prompt and wait for input. Call callback() regularly ****************************************************************************/ |