Bugzilla – Attachment 1541 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]
revised patch
woodblock.diff (text/plain), 12.14 KB, created by
Damien Miller
on 2008-07-04 22:32:46 AEST
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2008-07-04 22:32:46 AEST
Size:
12.14 KB
patch
obsolete
>Index: atomicio.c >=================================================================== >RCS file: /var/cvs/openssh/atomicio.c,v >retrieving revision 1.37 >diff -u -p -r1.37 atomicio.c >--- atomicio.c 26 Sep 2007 21:00:09 -0000 1.37 >+++ atomicio.c 4 Jul 2008 12:12:32 -0000 >@@ -63,11 +63,7 @@ atomicio(ssize_t (*f) (int, void *, size > 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 @@ atomiciov(ssize_t (*f) (int, const struc > 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.268 >diff -u -p -r1.268 channels.c >--- channels.c 16 Jun 2008 13:35:56 -0000 1.268 >+++ channels.c 4 Jul 2008 12:12:32 -0000 >@@ -1494,7 +1494,8 @@ channel_handle_rfd(Channel *c, fd_set *r > 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) { >@@ -1565,7 +1566,8 @@ channel_handle_wfd(Channel *c, fd_set *r > 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) >@@ -1583,7 +1585,8 @@ channel_handle_wfd(Channel *c, fd_set *r > #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) { >@@ -1635,7 +1638,8 @@ channel_handle_efd(Channel *c, fd_set *r > 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", >@@ -1650,8 +1654,8 @@ channel_handle_efd(Channel *c, fd_set *r > 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", >@@ -1675,7 +1679,8 @@ channel_handle_ctl(Channel *c, fd_set *r > /* 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.186 >diff -u -p -r1.186 clientloop.c >--- clientloop.c 12 Jun 2008 22:56:01 -0000 1.186 >+++ clientloop.c 4 Jul 2008 12:12:32 -0000 >@@ -663,7 +663,8 @@ client_process_net_input(fd_set *readset > * 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) { >@@ -1129,7 +1130,8 @@ client_process_input(fd_set *readset) > 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) { > /* >@@ -1186,7 +1188,8 @@ client_process_output(fd_set *writeset) > 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 { > /* >@@ -1210,7 +1213,8 @@ client_process_output(fd_set *writeset) > 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 { > /* >Index: defines.h >=================================================================== >RCS file: /var/cvs/openssh/defines.h,v >retrieving revision 1.150 >diff -u -p -r1.150 defines.h >--- defines.h 13 Jun 2008 00:28:57 -0000 1.150 >+++ defines.h 4 Jul 2008 12:12:32 -0000 >@@ -734,4 +734,8 @@ struct winsize { > # 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 -p -r1.129 includes.h >--- includes.h 28 Feb 2008 08:13:52 -0000 1.129 >+++ includes.h 4 Jul 2008 12:12:32 -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.156 >diff -u -p -r1.156 packet.c >--- packet.c 13 Jun 2008 12:02:50 -0000 1.156 >+++ packet.c 4 Jul 2008 12:13:22 -0000 >@@ -956,7 +956,8 @@ packet_read_seqnr(u_int32_t *seqnr_p) > if ((ret = select(connection_in + 1, setp, NULL, > NULL, timeoutp)) >= 0) > break; >- if (errno != EAGAIN && errno != EINTR) >+ if (errno != EAGAIN && errno != EINTR && >+ errno != EWOULDBLOCK) > break; > if (packet_timeout_ms == -1) > continue; >@@ -1475,7 +1476,7 @@ packet_write_poll(void) > 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)); >@@ -1516,7 +1517,8 @@ packet_write_wait(void) > if ((ret = select(connection_out + 1, NULL, setp, > NULL, timeoutp)) >= 0) > break; >- if (errno != EAGAIN && errno != EINTR) >+ if (errno != EAGAIN && errno != EINTR && >+ errno != EWOULDBLOCK) > break; > if (packet_timeout_ms == -1) > continue; >Index: scp.c >=================================================================== >RCS file: /var/cvs/openssh/scp.c,v >retrieving revision 1.180 >diff -u -p -r1.180 scp.c >--- scp.c 13 Jun 2008 23:02:25 -0000 1.180 >+++ scp.c 4 Jul 2008 12:12:32 -0000 >@@ -474,7 +474,7 @@ scpio(ssize_t (*f)(int, void *, size_t), > 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.160 >diff -u -p -r1.160 serverloop.c >--- serverloop.c 2 Jul 2008 12:32:14 -0000 1.160 >+++ serverloop.c 4 Jul 2008 12:12:32 -0000 >@@ -400,7 +400,8 @@ process_input(fd_set *readset) > 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)); >@@ -418,8 +419,8 @@ process_input(fd_set *readset) > 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) { >@@ -437,8 +438,8 @@ process_input(fd_set *readset) > 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) { >@@ -469,7 +470,8 @@ process_output(fd_set *writeset) > 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.93 >diff -u -p -r1.93 sftp-client.c >--- sftp-client.c 29 Jun 2008 12:46:35 -0000 1.93 >+++ sftp-client.c 4 Jul 2008 12:27:49 -0000 >@@ -1223,7 +1223,8 @@ do_upload(struct sftp_conn *conn, char * > 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.176 >diff -u -p -r1.176 ssh-agent.c >--- ssh-agent.c 29 Jun 2008 14:05:48 -0000 1.176 >+++ ssh-agent.c 4 Jul 2008 12:28:35 -0000 >@@ -961,7 +961,8 @@ after_select(fd_set *readset, fd_set *wr > 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); >@@ -975,7 +976,8 @@ after_select(fd_set *readset, fd_set *wr > 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 -p -r1.93 ssh-keyscan.c >--- ssh-keyscan.c 19 May 2008 04:56:33 -0000 1.93 >+++ ssh-keyscan.c 4 Jul 2008 12:12:32 -0000 >@@ -656,7 +656,7 @@ conloop(void) > 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.380 >diff -u -p -r1.380 sshd.c >--- sshd.c 2 Jul 2008 12:34:30 -0000 1.380 >+++ sshd.c 4 Jul 2008 12:12:32 -0000 >@@ -1096,7 +1096,8 @@ server_accept_loop(int *sock_in, int *so > *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
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 1467
:
1506
| 1541