summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-14 12:14:12 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-28 16:40:20 +0100
commitf7bd09665ae1dfed2a503314f4b4946fe0ee1bf5 (patch)
tree144d8ba0098b039ade2e36496de38fd9a00311c7 /libcli
parentd825b5e2cb960fdc348d068a7af3ffbd54cc1c3f (diff)
downloadsamba-f7bd09665ae1dfed2a503314f4b4946fe0ee1bf5.tar.gz
samba-f7bd09665ae1dfed2a503314f4b4946fe0ee1bf5.tar.bz2
samba-f7bd09665ae1dfed2a503314f4b4946fe0ee1bf5.zip
libcli: Eliminate select from smb_readline_replacement
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smbreadline/smbreadline.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libcli/smbreadline/smbreadline.c b/libcli/smbreadline/smbreadline.c
index f8441ac5a3..cff25a7f5a 100644
--- a/libcli/smbreadline/smbreadline.c
+++ b/libcli/smbreadline/smbreadline.c
@@ -70,9 +70,7 @@ void smb_readline_done(void)
static char *smb_readline_replacement(const char *prompt, void (*callback)(void),
char **(completion_fn)(const char *text, int start, int end))
{
- fd_set fds;
char *line = NULL;
- struct timeval timeout;
int fd = x_fileno(x_stdin);
char *ret;
@@ -88,13 +86,13 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
}
while (!smb_rl_done) {
- timeout.tv_sec = 5;
- timeout.tv_usec = 0;
+ struct pollfd pfd;
- FD_ZERO(&fds);
- FD_SET(fd,&fds);
+ ZERO_STRUCT(pfd);
+ pfd.fd = fd;
+ pfd.events = POLLIN|POLLHUP;
- if (sys_select_intr(fd+1,&fds,NULL,NULL,&timeout) == 1) {
+ if (sys_poll_intr(&pfd, 1, 5000) == 1) {
ret = x_fgets(line, BUFSIZ, x_stdin);
if (ret == 0) {
SAFE_FREE(line);