Permalink
Browse files

There's an unconditional wait that was added for some corner

cases. The reapchild routine is being called without a thread
to wait for. This is causing it to hang after printing.

Removed the wait.

Thanks to Mr Igli (igli in ##posix on freenode)
  • Loading branch information...
joejulian committed Mar 27, 2013
1 parent defc6dd commit 95b7553f07afe951975071dbf7138d22fe3bf86c
Showing with 2 additions and 3 deletions.
  1. +2 −3 main.c
View
5 main.c
@@ -4991,6 +4991,7 @@ resize_termcap(XtermWidget xw)
* doesn't support non-blocking wait, do nothing.
* Returns the pid of the child, or 0 or -1 if none or error.
*/
+
int
nonblocking_wait(void)
{
@@ -5011,7 +5012,7 @@ nonblocking_wait(void)
pid = wait3(&status, WNOHANG, (struct rusage *) NULL);
#endif /* USE_POSIX_WAIT else */
- return pid;
+ return (int) pid;
}
#ifndef VMS
@@ -5023,8 +5024,6 @@ reapchild(int n GCC_UNUSED)
int olderrno = errno;
int pid;
- pid = wait(NULL);
-
#ifdef USE_SYSV_SIGNALS
/* cannot re-enable signal before waiting for child
* because then SVR4 loops. Sigh. HP-UX 9.01 too.

0 comments on commit 95b7553

Please sign in to comment.