Bugzilla – Attachment 572 Details for
Bug 52
ssh hangs on exit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Unpacked attachment
base-devel.udiff (text/plain), 4.86 KB, created by
Damien Miller
on 2004-03-12 09:56:33 AEDT
(
hide
)
Description:
Unpacked attachment
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2004-03-12 09:56:33 AEDT
Size:
4.86 KB
patch
obsolete
>diff -aENRru -x CVS -x test openssh-3.8p1/channels.c devel/channels.c >--- openssh-3.8p1/channels.c Tue Jan 20 17:02:09 2004 >+++ devel/channels.c Fri Feb 27 15:44:09 2004 >@@ -1353,7 +1353,7 @@ > if (c->rfd != -1 && > FD_ISSET(c->rfd, readset)) { > len = read(c->rfd, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) >+ if (len < 0 && errno == EINTR) > return 1; > if (len <= 0) { > debug2("channel %d: read<=0 rfd %d len %d", >@@ -1468,7 +1468,7 @@ > 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)) >+ if (len < 0 && errno == EINTR) > return 1; > if (len <= 0) { > debug2("channel %d: closing read-efd %d", >diff -aENRru -x CVS -x test openssh-3.8p1/serverloop.c devel/serverloop.c >--- openssh-3.8p1/serverloop.c Tue Jan 20 17:02:50 2004 >+++ devel/serverloop.c Fri Feb 27 15:53:33 2004 >@@ -245,6 +245,7 @@ > struct timeval tv, *tvp; > int ret; > int client_alive_scheduled = 0; >+ int program_alive_scheduled = 0; > > /* > * if using client_alive, set the max timeout accordingly, >@@ -282,6 +283,7 @@ > * the client, try to get some more data from the program. > */ > if (packet_not_very_much_data_to_write()) { >+ program_alive_scheduled = child_terminated; > if (!fdout_eof) > FD_SET(fdout, *readsetp); > if (!fderr_eof) >@@ -327,8 +329,16 @@ > memset(*writesetp, 0, *nallocp); > if (errno != EINTR) > error("select: %.100s", strerror(errno)); >- } else if (ret == 0 && client_alive_scheduled) >- client_alive_check(); >+ } else if (ret == 0) { >+ if (client_alive_scheduled) >+ client_alive_check(); >+ if (program_alive_scheduled && fdin_is_tty) { >+ if (!fdout_eof) >+ FD_SET(fdout, *readsetp); >+ if (!fderr_eof) >+ FD_SET(fderr, *readsetp); >+ } >+ } > > notify_done(*readsetp); > } >@@ -371,7 +381,7 @@ > /* Read and buffer any available stdout data from the program. */ > if (!fdout_eof && FD_ISSET(fdout, readset)) { > len = read(fdout, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) { >+ if (len < 0 && errno == EINTR) { > /* do nothing */ > } else if (len <= 0) { > fdout_eof = 1; >@@ -383,7 +393,7 @@ > /* Read and buffer any available stderr data from the program. */ > if (!fderr_eof && FD_ISSET(fderr, readset)) { > len = read(fderr, buf, sizeof(buf)); >- if (len < 0 && (errno == EINTR || errno == EAGAIN)) { >+ if (len < 0 && errno == EINTR) { > /* do nothing */ > } else if (len <= 0) { > fderr_eof = 1; >@@ -715,7 +725,7 @@ > } > > static void >-collect_children(void) >+collect_children(fd_set **readsetp) > { > pid_t pid; > sigset_t oset, nset; >@@ -729,7 +739,7 @@ > while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || > (pid < 0 && errno == EINTR)) > if (pid > 0) >- session_close_by_pid(pid, status); >+ session_close_by_pid(pid, status, readsetp); > child_terminated = 0; > } > sigprocmask(SIG_SETMASK, &oset, NULL); >@@ -765,7 +775,7 @@ > wait_until_can_do_something(&readset, &writeset, &max_fd, > &nalloc, 0); > >- collect_children(); >+ collect_children(&readset); > if (!rekeying) { > channel_after_select(readset, writeset); > if (packet_need_rekeying()) { >@@ -779,7 +789,7 @@ > break; > process_output(writeset); > } >- collect_children(); >+ collect_children(&readset); > > if (readset) > xfree(readset); >diff -aENRru -x CVS -x test openssh-3.8p1/session.c devel/session.c >--- openssh-3.8p1/session.c Mon Feb 23 06:01:27 2004 >+++ devel/session.c Fri Feb 27 16:03:55 2004 >@@ -1962,7 +1962,7 @@ > } > > static void >-session_exit_message(Session *s, int status) >+session_exit_message(Session *s, int status, fd_set **readsetp) > { > Channel *c; > >@@ -1972,6 +1972,13 @@ > debug("session_exit_message: session %d channel %d pid %ld", > s->self, s->chanid, (long)s->pid); > >+ if (s->ptyfd != -1) { >+ if (c->rfd != -1) >+ FD_SET(c->rfd, *readsetp); >+ if (c->efd != -1) >+ FD_SET(c->efd, *readsetp); >+ } >+ > if (WIFEXITED(status)) { > channel_request_start(s->chanid, "exit-status", 0); > packet_put_int(WEXITSTATUS(status)); >@@ -2027,7 +2034,7 @@ > } > > void >-session_close_by_pid(pid_t pid, int status) >+session_close_by_pid(pid_t pid, int status, fd_set **readsetp) > { > Session *s = session_by_pid(pid); > if (s == NULL) { >@@ -2036,7 +2043,7 @@ > return; > } > if (s->chanid != -1) >- session_exit_message(s, status); >+ session_exit_message(s, status, readsetp); > session_close(s); > } > >diff -aENRru -x CVS -x test openssh-3.8p1/session.h devel/session.h >--- openssh-3.8p1/session.h Thu Oct 2 00:12:37 2003 >+++ devel/session.h Fri Feb 27 16:01:39 2004 >@@ -60,7 +60,7 @@ > > int session_open(Authctxt *, int); > int session_input_channel_req(Channel *, const char *); >-void session_close_by_pid(pid_t, int); >+void session_close_by_pid(pid_t, int, fd_set **); > void session_close_by_channel(int, void *); > void session_destroy_all(void (*)(Session *)); > void session_pty_cleanup2(Session *);
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 52
:
557
|
572
|
667
|
801
|
1075
|
1098
|
1214
|
1215
|
1227
|
1242
|
1243