[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] bash-3.0: avoid WCONTINUED if invalid
From: |
Tim Waugh |
Subject: |
[patch] bash-3.0: avoid WCONTINUED if invalid |
Date: |
Wed, 8 Sep 2004 16:52:38 +0100 |
User-agent: |
Mutt/1.4.1i |
Hi,
GNU libc defines WCONTINUED, but (at least on Linux 2.4.x kernels)
waitpid() returns -1 with errno set to EINVAL if WCONTINUED is
supplied in options.
Here is a patch to retry without WCONTINUED set in that case.
Tim.
*/
--- bash-3.0/jobs.c.jobs 2004-09-08 16:07:25.081427747 +0100
+++ bash-3.0/jobs.c 2004-09-08 16:18:06.698604033 +0100
@@ -2475,6 +2475,7 @@
PROCESS *child;
pid_t pid;
int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
+ static int wcontinued_not_supported = 0;
call_set_current = children_exited = 0;
last_stopped_job = NO_JOB;
@@ -2488,7 +2489,15 @@
: 0;
if (sigchld || block == 0)
waitpid_flags |= WNOHANG;
+ retry:
+ if (wcontinued_not_supported)
+ waitpid_flags &= ~WCONTINUED;
pid = WAITPID (-1, &status, waitpid_flags);
+ if (errno == EINVAL)
+ {
+ wcontinued_not_supported = 1;
+ goto retry;
+ }
/* The check for WNOHANG is to make sure we decrement sigchld only
if it was non-zero before we called waitpid. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [patch] bash-3.0: avoid WCONTINUED if invalid,
Tim Waugh <=