mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-11 05:51:21 -08:00
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.
This commit is contained in:
parent
29bb19dc10
commit
d78cf5edf9
2 changed files with 15 additions and 31 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2013-02-22 Claudio Bley <claudio.bley@gmail.com>
|
||||
|
||||
* 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 <kbrown@cornell.edu>
|
||||
|
||||
* sheap.c (report_sheap_usage): Fix arguments of message1_no_log.
|
||||
|
|
|
|||
41
src/w32.c
41
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);
|
||||
/* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. */
|
||||
if (err == EWOULDBLOCK)
|
||||
err = EAGAIN;
|
||||
|
||||
/* Use select with the timeout to poll the selector. */
|
||||
sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
|
||||
&timeout, NULL);
|
||||
emacs_gnutls_transport_set_errno (process->gnutls_state, err);
|
||||
|
||||
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. */
|
||||
}
|
||||
|
||||
emacs_gnutls_transport_set_errno (process->gnutls_state, err);
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue