From: Claudio Bley Date: Fri, 22 Feb 2013 16:00:14 +0000 (+0200) Subject: Don't call 'select' from emacs_gnutls_pull. X-Git-Tag: emacs-24.3.90~173^2~6^2~62 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d78cf5edf9b4aebfc6a5821d88ba1ee3eb00aebb;p=emacs.git Don't call 'select' from emacs_gnutls_pull. src/w32.c (emacs_gnutls_pull): Don't call 'select', and don't loop. This avoids warning messages reported as part of Bug#13546. --- diff --git a/src/ChangeLog b/src/ChangeLog index ff45c4b2a83..639e0054ebe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-02-22 Claudio Bley + + * w32.c (emacs_gnutls_pull): Don't call 'select', and don't loop. + This avoids warning messages reported as part of Bug#13546. + 2013-02-21 Ken Brown * sheap.c (report_sheap_usage): Fix arguments of message1_no_log. diff --git a/src/w32.c b/src/w32.c index ed86b1238ae..5011642adf2 100644 --- a/src/w32.c +++ b/src/w32.c @@ -7822,47 +7822,26 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact) ssize_t emacs_gnutls_pull (gnutls_transport_ptr_t p, void* buf, size_t sz) { - int n, sc, err; + int n, err; SELECT_TYPE fdset; EMACS_TIME timeout; struct Lisp_Process *process = (struct Lisp_Process *)p; int fd = process->infd; - for (;;) - { - n = sys_read (fd, (char*)buf, sz); + n = sys_read (fd, (char*)buf, sz); - if (n >= 0) - return n; + if (n >= 0) + return n; - err = errno; + err = errno; - if (err == EWOULDBLOCK) - { - /* Set a small timeout. */ - timeout = make_emacs_time (1, 0); - FD_ZERO (&fdset); - FD_SET ((int)fd, &fdset); - - /* Use select with the timeout to poll the selector. */ - sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0, - &timeout, NULL); - - if (sc > 0) - continue; /* Try again. */ - - /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. - Also accept select return 0 as an indicator to EAGAIN. */ - if (sc == 0 || errno == EWOULDBLOCK) - err = EAGAIN; - else - err = errno; /* Other errors are just passed on. */ - } + /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. */ + if (err == EWOULDBLOCK) + err = EAGAIN; - emacs_gnutls_transport_set_errno (process->gnutls_state, err); + emacs_gnutls_transport_set_errno (process->gnutls_state, err); - return -1; - } + return -1; } ssize_t