Bugzilla – Attachment 1506 Details for
Bug 1467
improper handling of EWOULDBLOCK on HP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
test for EWOULDBLOCK everywhere we currently check for EAGAIN
woodblock.dif (text/plain), 11.67 KB, created by
Damien Miller
on 2008-05-22 03:36:37 AEST
(
hide
)
Description:
test for EWOULDBLOCK everywhere we currently check for EAGAIN
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2008-05-22 03:36:37 AEST
Size:
11.67 KB
patch
obsolete
>? regress/authorized_keys_djm >? regress/host.rsa >? regress/host.rsa1 >? regress/known_hosts >? regress/remote_pid >? regress/rsa >? regress/rsa-agent >? regress/rsa-agent.pub >? regress/rsa.pub >? regress/rsa1 >? regress/rsa1-agent >? regress/rsa1-agent.pub >? regress/rsa1.pub >? regress/ssh_config >? regress/ssh_proxy >? regress/sshd_config >? regress/sshd_proxy >? regress/sshd_proxy_bak >? regress/t2.out >? regress/t6.out1 >? regress/t6.out2 >? regress/t7.out >? regress/t7.out.pub >Index: atomicio.c >=================================================================== >RCS file: /var/cvs/openssh/atomicio.c,v >retrieving revision 1.37 >diff -u -r1.37 atomicio.c >--- atomicio.c 26 Sep 2007 21:00:09 -0000 1.37 >+++ atomicio.c 21 May 2008 17:33:49 -0000 >@@ -63,11 +63,7 @@ > case -1: > if (errno == EINTR) > continue; >-#ifdef EWOULDBLOCK > if (errno == EAGAIN || errno == EWOULDBLOCK) { >-#else >- if (errno == EAGAIN) { >-#endif > (void)poll(&pfd, 1, -1); > continue; > } >@@ -109,11 +105,7 @@ > case -1: > if (errno == EINTR) > continue; >-#ifdef EWOULDBLOCK > if (errno == EAGAIN || errno == EWOULDBLOCK) { >-#else >- if (errno == EAGAIN) { >-#endif > (void)poll(&pfd, 1, -1); > continue; > } >Index: channels.c >=================================================================== >RCS file: /var/cvs/openssh/channels.c,v >retrieving revision 1.261 >diff -u -r1.261 channels.c >--- channels.c 19 May 2008 06:05:41 -0000 1.261 >+++ channels.c 21 May 2008 17:33:55 -0000 >@@ -1497,7 +1497,8 @@ > if (c->rfd != -1 && (force || FD_ISSET(c->rfd, readset))) { > errno = 0; > len = read(c->rfd, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || (errno == EAGAIN && !force))) >+ if (len < 0 && (errno == EINTR || >+ ((errno == EAGAIN || errno == EWOULDBLOCK) && !force))) > return 1; > #ifndef PTY_ZEROREAD > if (len <= 0) { >@@ -1568,7 +1569,8 @@ > c->local_consumed += dlen + 4; > len = write(c->wfd, buf, dlen); > xfree(data); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) >+ if (len < 0 && (errno == EINTR || errno == EAGAIN || >+ errno == EWOULDBLOCK)) > return 1; > if (len <= 0) { > if (c->type != SSH_CHANNEL_OPEN) >@@ -1586,7 +1588,8 @@ > #endif > > len = write(c->wfd, buf, dlen); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) >+ if (len < 0 && >+ (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) > return 1; > if (len <= 0) { > if (c->type != SSH_CHANNEL_OPEN) { >@@ -1638,7 +1641,8 @@ > buffer_len(&c->extended)); > debug2("channel %d: written %d to efd %d", > c->self, len, c->efd); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) >+ if (len < 0 && (errno == EINTR || errno == EAGAIN || >+ errno == EWOULDBLOCK)) > return 1; > if (len <= 0) { > debug2("channel %d: closing write-efd %d", >@@ -1653,8 +1657,8 @@ > len = read(c->efd, buf, sizeof(buf)); > debug2("channel %d: read %d from efd %d", > c->self, len, c->efd); >- if (len < 0 && (errno == EINTR || >- (errno == EAGAIN && !c->detach_close))) >+ if (len < 0 && (errno == EINTR || ((errno == EAGAIN || >+ errno == EWOULDBLOCK) && !c->detach_close))) > return 1; > if (len <= 0) { > debug2("channel %d: closing read-efd %d", >@@ -1678,7 +1682,8 @@ > /* Monitor control fd to detect if the slave client exits */ > if (c->ctl_fd != -1 && FD_ISSET(c->ctl_fd, readset)) { > len = read(c->ctl_fd, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) >+ if (len < 0 && >+ (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) > return 1; > if (len <= 0) { > debug2("channel %d: ctl read<=0", c->self); >Index: clientloop.c >=================================================================== >RCS file: /var/cvs/openssh/clientloop.c,v >retrieving revision 1.179 >diff -u -r1.179 clientloop.c >--- clientloop.c 19 May 2008 06:06:47 -0000 1.179 >+++ clientloop.c 21 May 2008 17:33:59 -0000 >@@ -623,7 +623,8 @@ > * There is a kernel bug on Solaris that causes select to > * sometimes wake up even though there is no data available. > */ >- if (len < 0 && (errno == EAGAIN || errno == EINTR)) >+ if (len < 0 && >+ (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > len = 0; > > if (len < 0) { >@@ -1001,7 +1002,8 @@ > if (FD_ISSET(fileno(stdin), readset)) { > /* Read as much as possible. */ > len = read(fileno(stdin), buf, sizeof(buf)); >- if (len < 0 && (errno == EAGAIN || errno == EINTR)) >+ if (len < 0 && >+ (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > return; /* we'll try again later */ > if (len <= 0) { > /* >@@ -1056,7 +1058,8 @@ > len = write(fileno(stdout), buffer_ptr(&stdout_buffer), > buffer_len(&stdout_buffer)); > if (len <= 0) { >- if (errno == EINTR || errno == EAGAIN) >+ if (errno == EINTR || errno == EAGAIN || >+ errno == EWOULDBLOCK) > len = 0; > else { > /* >@@ -1079,7 +1082,8 @@ > len = write(fileno(stderr), buffer_ptr(&stderr_buffer), > buffer_len(&stderr_buffer)); > if (len <= 0) { >- if (errno == EINTR || errno == EAGAIN) >+ if (errno == EINTR || errno == EAGAIN || >+ errno == EWOULDBLOCK) > len = 0; > else { > /* EOF or error, but can't even print error message. */ >Index: defines.h >=================================================================== >RCS file: /var/cvs/openssh/defines.h,v >retrieving revision 1.146 >diff -u -r1.146 defines.h >--- defines.h 28 Feb 2008 08:22:04 -0000 1.146 >+++ defines.h 21 May 2008 17:33:59 -0000 >@@ -729,4 +729,8 @@ > # endif > #endif > >+#ifndef EWOULDBLOCK >+# define EWOULDBLOCK EAGAIN >+#endif >+ > #endif /* _DEFINES_H */ >Index: includes.h >=================================================================== >RCS file: /var/cvs/openssh/includes.h,v >retrieving revision 1.129 >diff -u -r1.129 includes.h >--- includes.h 28 Feb 2008 08:13:52 -0000 1.129 >+++ includes.h 21 May 2008 17:33:59 -0000 >@@ -149,6 +149,8 @@ > # include <sys/syslog.h> > #endif > >+#include <errno.h> >+ > /* > * On HP-UX 11.11, shadow.h and prot.h provide conflicting declarations > * of getspnam when _INCLUDE__STDC__ is defined, so we unset it here. >Index: packet.c >=================================================================== >RCS file: /var/cvs/openssh/packet.c,v >retrieving revision 1.153 >diff -u -r1.153 packet.c >--- packet.c 19 May 2008 04:59:37 -0000 1.153 >+++ packet.c 21 May 2008 17:34:02 -0000 >@@ -927,7 +927,7 @@ > > /* Wait for some data to arrive. */ > while (select(connection_in + 1, setp, NULL, NULL, NULL) == -1 && >- (errno == EAGAIN || errno == EINTR)) >+ (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > ; > > /* Read data from the socket. */ >@@ -1433,7 +1433,7 @@ > if (len > 0) { > len = write(connection_out, buffer_ptr(&output), len); > if (len <= 0) { >- if (errno == EAGAIN) >+ if (errno == EAGAIN || errno == EWOULDBLOCK) > return; > else > fatal("Write failed: %.100s", strerror(errno)); >@@ -1460,7 +1460,7 @@ > sizeof(fd_mask)); > FD_SET(connection_out, setp); > while (select(connection_out + 1, NULL, setp, NULL, NULL) == -1 && >- (errno == EAGAIN || errno == EINTR)) >+ (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > ; > packet_write_poll(); > } >Index: scp.c >=================================================================== >RCS file: /var/cvs/openssh/scp.c,v >retrieving revision 1.179 >diff -u -r1.179 scp.c >--- scp.c 14 Mar 2008 00:59:50 -0000 1.179 >+++ scp.c 21 May 2008 17:34:04 -0000 >@@ -474,7 +474,7 @@ > if (r < 0) { > if (errno == EINTR) > continue; >- if (errno == EAGAIN) { >+ if (errno == EAGAIN || errno == EWOULDBLOCK) { > (void)poll(&pfd, 1, -1); /* Ignore errors */ > continue; > } >Index: serverloop.c >=================================================================== >RCS file: /var/cvs/openssh/serverloop.c,v >retrieving revision 1.157 >diff -u -r1.157 serverloop.c >--- serverloop.c 19 May 2008 06:06:47 -0000 1.157 >+++ serverloop.c 21 May 2008 17:34:05 -0000 >@@ -399,7 +399,8 @@ > return; > cleanup_exit(255); > } else if (len < 0) { >- if (errno != EINTR && errno != EAGAIN) { >+ if (errno != EINTR && errno != EAGAIN && >+ errno != EWOULDBLOCK) { > verbose("Read error from remote host " > "%.100s: %.100s", > get_remote_ipaddr(), strerror(errno)); >@@ -417,8 +418,8 @@ > if (!fdout_eof && FD_ISSET(fdout, readset)) { > errno = 0; > len = read(fdout, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || >- (errno == EAGAIN && !child_terminated))) { >+ if (len < 0 && (errno == EINTR || ((errno == EAGAIN || >+ errno == EWOULDBLOCK) && !child_terminated))) { > /* do nothing */ > #ifndef PTY_ZEROREAD > } else if (len <= 0) { >@@ -436,8 +437,8 @@ > if (!fderr_eof && FD_ISSET(fderr, readset)) { > errno = 0; > len = read(fderr, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || >- (errno == EAGAIN && !child_terminated))) { >+ if (len < 0 && (errno == EINTR || ((errno == EAGAIN || >+ errno == EWOULDBLOCK) && !child_terminated))) { > /* do nothing */ > #ifndef PTY_ZEROREAD > } else if (len <= 0) { >@@ -468,7 +469,8 @@ > data = buffer_ptr(&stdin_buffer); > dlen = buffer_len(&stdin_buffer); > len = write(fdin, data, dlen); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) { >+ if (len < 0 && >+ (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) { > /* do nothing */ > } else if (len <= 0) { > if (fdin != fdout) >Index: sftp-client.c >=================================================================== >RCS file: /var/cvs/openssh/sftp-client.c,v >retrieving revision 1.87 >diff -u -r1.87 sftp-client.c >--- sftp-client.c 19 May 2008 04:53:33 -0000 1.87 >+++ sftp-client.c 21 May 2008 17:34:07 -0000 >@@ -1210,7 +1210,8 @@ > len = 0; > else do > len = read(local_fd, data, conn->transfer_buflen); >- while ((len == -1) && (errno == EINTR || errno == EAGAIN)); >+ while ((len == -1) && >+ (errno == EINTR || errno == EAGAIN || errno != EWOULDBLOCK)); > > if (len == -1) > fatal("Couldn't read from \"%s\": %s", local_path, >Index: ssh-agent.c >=================================================================== >RCS file: /var/cvs/openssh/ssh-agent.c,v >retrieving revision 1.174 >diff -u -r1.174 ssh-agent.c >--- ssh-agent.c 28 Feb 2008 08:13:52 -0000 1.174 >+++ ssh-agent.c 21 May 2008 17:34:07 -0000 >@@ -950,7 +950,7 @@ > buffer_ptr(&sockets[i].output), > buffer_len(&sockets[i].output)); > if (len == -1 && (errno == EAGAIN || >- errno == EINTR)) >+ errno == EINTR || errno == EWOULDBLOCK)) > continue; > break; > } while (1); >@@ -964,7 +964,7 @@ > do { > len = read(sockets[i].fd, buf, sizeof(buf)); > if (len == -1 && (errno == EAGAIN || >- errno == EINTR)) >+ errno == EINTR || errno == EWOULDBLOCK)) > continue; > break; > } while (1); >Index: ssh-keyscan.c >=================================================================== >RCS file: /var/cvs/openssh/ssh-keyscan.c,v >retrieving revision 1.93 >diff -u -r1.93 ssh-keyscan.c >--- ssh-keyscan.c 19 May 2008 04:56:33 -0000 1.93 >+++ ssh-keyscan.c 21 May 2008 17:34:08 -0000 >@@ -656,7 +656,7 @@ > memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); > > while (select(maxfd, r, NULL, e, &seltime) == -1 && >- (errno == EAGAIN || errno == EINTR)) >+ (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > ; > > for (i = 0; i < maxfd; i++) { >Index: sshd.c >=================================================================== >RCS file: /var/cvs/openssh/sshd.c,v >retrieving revision 1.374 >diff -u -r1.374 sshd.c >--- sshd.c 19 May 2008 05:05:08 -0000 1.374 >+++ sshd.c 21 May 2008 17:34:11 -0000 >@@ -1093,7 +1093,8 @@ > *newsock = accept(listen_socks[i], > (struct sockaddr *)&from, &fromlen); > if (*newsock < 0) { >- if (errno != EINTR && errno != EWOULDBLOCK) >+ if (errno != EINTR && errno != EAGAIN && >+ errno != EWOULDBLOCK) > error("accept: %.100s", strerror(errno)); > continue; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1467
:
1506
|
1541