Bugzilla – Attachment 994 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]
only close connection for zero-length stdin reads when errno set
openssh-aix_pty_zero_read.patch (text/plain), 2.42 KB, created by
Darren Tucker
on 2005-10-13 21:31:16 AEST
(
hide
)
Description:
only close connection for zero-length stdin reads when errno set
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2005-10-13 21:31:16 AEST
Size:
2.42 KB
patch
obsolete
>Index: channels.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/channels.c,v >retrieving revision 1.202 >diff -u -p -r1.202 channels.c >--- channels.c 3 Oct 2005 08:03:05 -0000 1.202 >+++ channels.c 13 Oct 2005 11:28:24 -0000 >@@ -1374,10 +1374,11 @@ channel_handle_rfd(Channel *c, fd_set * > > 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; >- if (len <= 0) { >+ if (len < 0 || (len == 0 && errno != 0)) { > debug2("channel %d: read<=0 rfd %d len %d", > c->self, c->rfd, len); > if (c->type != SSH_CHANNEL_OPEN) { >@@ -1511,10 +1512,11 @@ channel_handle_ctl(Channel *c, fd_set * > > /* Monitor control fd to detect if the slave client exits */ > if (c->ctl_fd != -1 && FD_ISSET(c->ctl_fd, readset)) { >+ errno = 0; > len = read(c->ctl_fd, buf, sizeof(buf)); > if (len < 0 && (errno == EINTR || errno == EAGAIN)) > return 1; >- if (len <= 0) { >+ if (len < 0 || (len == 0 && errno != 0)) { > debug2("channel %d: ctl read<=0", c->self); > if (c->type != SSH_CHANNEL_OPEN) { > debug2("channel %d: not open", c->self); >Index: serverloop.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/serverloop.c,v >retrieving revision 1.119 >diff -u -p -r1.119 serverloop.c >--- serverloop.c 17 Jul 2005 07:26:44 -0000 1.119 >+++ serverloop.c 13 Oct 2005 10:45:10 -0000 >@@ -370,10 +370,11 @@ 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 */ >- } else if (len <= 0) { >+ } else if (len < 0 || (len == 0 && errno != 0)) { > fdout_eof = 1; > } else { > buffer_append(&stdout_buffer, buf, len); >@@ -382,10 +383,11 @@ 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 */ >- } else if (len <= 0) { >+ } else if (len < 0 || (len == 0 && errno != 0)) { > 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
Actions:
View
|
Diff
Attachments on
bug 1102
:
987
|
988
|
990
|
991
|
992
|
993
|
994
|
1002
|
1147
|
1208