Bugzilla – Attachment 1147 Details for
Bug 1102
C program 'write' with zero length hangs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Handle zero-length reads on AIX only
openssh-aixpty-zeroread.patch (text/plain), 2.62 KB, created by
Darren Tucker
on 2006-06-23 20:55:22 AEST
(
hide
)
Description:
Handle zero-length reads on AIX only
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2006-06-23 20:55:22 AEST
Size:
2.62 KB
patch
obsolete
>Index: channels.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/channels.c,v >retrieving revision 1.229 >diff -u -p -r1.229 channels.c >--- channels.c 23 Apr 2006 02:06:03 -0000 1.229 >+++ channels.c 23 Jun 2006 10:49:38 -0000 >@@ -1415,10 +1415,15 @@ channel_handle_rfd(Channel *c, fd_set *r > > if (c->rfd != -1 && > FD_ISSET(c->rfd, readset)) { >+ errno = 0; > len = read(c->rfd, buf, sizeof(buf)); > if (len < 0 && (errno == EINTR || errno == EAGAIN)) > return 1; >+#ifndef PTY_ZEROREAD > if (len <= 0) { >+#else >+ if (len < 0 || (len == 0 && errno != 0)) { >+#endif > debug2("channel %d: read<=0 rfd %d len %d", > c->self, c->rfd, len); > if (c->type != SSH_CHANNEL_OPEN) { >Index: configure.ac >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/configure.ac,v >retrieving revision 1.339 >diff -u -p -r1.339 configure.ac >--- configure.ac 22 Apr 2006 11:26:08 -0000 1.339 >+++ configure.ac 23 Jun 2006 09:13:53 -0000 >@@ -190,6 +190,7 @@ case "$host" in > supported by bsd-setproctitle.c]) > AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1, > [AIX 5.2 and 5.3 (and presumably newer) require this]) >+ AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd]) > ;; > *-*-cygwin*) > check_for_libcrypt_later=1 >Index: serverloop.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/serverloop.c,v >retrieving revision 1.137 >diff -u -p -r1.137 serverloop.c >--- serverloop.c 26 Mar 2006 03:25:37 -0000 1.137 >+++ serverloop.c 23 Jun 2006 10:49:38 -0000 >@@ -387,10 +387,15 @@ process_input(fd_set *readset) > > /* Read and buffer any available stdout data from the program. */ > if (!fdout_eof && FD_ISSET(fdout, readset)) { >+ errno = 0; > len = read(fdout, buf, sizeof(buf)); > if (len < 0 && (errno == EINTR || errno == EAGAIN)) { > /* do nothing */ >+#ifdef PTY_ZEROREAD > } else if (len <= 0) { >+#else >+ } else if (len < 0 || (len == 0 && errno != 0)) { >+#endif > fdout_eof = 1; > } else { > buffer_append(&stdout_buffer, buf, len); >@@ -399,10 +404,15 @@ process_input(fd_set *readset) > } > /* Read and buffer any available stderr data from the program. */ > if (!fderr_eof && FD_ISSET(fderr, readset)) { >+ errno = 0; > len = read(fderr, buf, sizeof(buf)); > if (len < 0 && (errno == EINTR || errno == EAGAIN)) { > /* do nothing */ >+#ifdef PTY_ZEROREAD > } else if (len <= 0) { >+#else >+ } else if (len < 0 || (len == 0 && errno != 0)) { >+#endif > fderr_eof = 1; > } else { > buffer_append(&stderr_buffer, buf, len);
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:
djm
:
ok+
Actions:
View
|
Diff
Attachments on
bug 1102
:
987
|
988
|
990
|
991
|
992
|
993
|
994
|
1002
|
1147
|
1208