Bugzilla – Attachment 667 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]
Update to -current
exithang2.diff (text/plain), 5.24 KB, created by
Damien Miller
on 2004-06-26 09:33:59 AEST
(
hide
)
Description:
Update to -current
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2004-06-26 09:33:59 AEST
Size:
5.24 KB
patch
obsolete
>Index: channels.c >=================================================================== >RCS file: /var/cvs/openssh/channels.c,v >retrieving revision 1.185 >diff -u -r1.185 channels.c >--- channels.c 22 Jun 2004 02:56:02 -0000 1.185 >+++ channels.c 25 Jun 2004 23:26:10 -0000 >@@ -1364,7 +1364,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", >@@ -1479,7 +1479,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", >Index: serverloop.c >=================================================================== >RCS file: /var/cvs/openssh/serverloop.c,v >retrieving revision 1.116 >diff -u -r1.116 serverloop.c >--- serverloop.c 24 May 2004 00:18:05 -0000 1.116 >+++ serverloop.c 25 Jun 2004 23:26:11 -0000 >@@ -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); >Index: session.c >=================================================================== >RCS file: /var/cvs/openssh/session.c,v >retrieving revision 1.282 >diff -u -r1.282 session.c >--- session.c 22 Jun 2004 02:57:09 -0000 1.282 >+++ session.c 25 Jun 2004 23:26:12 -0000 >@@ -2014,7 +2014,7 @@ > } > > static void >-session_exit_message(Session *s, int status) >+session_exit_message(Session *s, int status, fd_set **readsetp) > { > Channel *c; > >@@ -2024,6 +2024,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)); >@@ -2087,7 +2094,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) { >@@ -2096,7 +2103,7 @@ > return; > } > if (s->chanid != -1) >- session_exit_message(s, status); >+ session_exit_message(s, status, readsetp); > session_close(s); > } > >Index: session.h >=================================================================== >RCS file: /var/cvs/openssh/session.h,v >retrieving revision 1.26 >diff -u -r1.26 session.h >--- session.h 2 May 2004 12:11:30 -0000 1.26 >+++ session.h 25 Jun 2004 23:26:12 -0000 >@@ -65,7 +65,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