source: scripts/patches/bash-3.0-avoid_WCONTINUED_if_invalid.patch@ 9617ced

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 9617ced was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[617118d]1Reported on bug-bash by Tim Waugh <twaugh@redhat.com>
2http://lists.gnu.org/archive/html/bug-bash/2004-09/msg00081.html
3
4GNU libc defines WCONTINUED, but (at least on Linux 2.4.x kernels)
5waitpid() returns -1 with errno set to EINVAL if WCONTINUED is
6supplied in options.
7
8Here is a patch to retry without WCONTINUED set in that case.
9
10--- bash-3.0/jobs.c.jobs 2004-09-08 16:07:25.081427747 +0100
11+++ bash-3.0/jobs.c 2004-09-08 16:18:06.698604033 +0100
12@@ -2475,6 +2475,7 @@
13@@ -2471,6 +2471,7 @@
14 PROCESS *child;
15 pid_t pid;
16 int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
17+ static int wcontinued_not_supported = 0;
18
19 call_set_current = children_exited = 0;
20 last_stopped_job = NO_JOB;
21@@ -2484,7 +2485,15 @@
22 : 0;
23 if (sigchld || block == 0)
24 waitpid_flags |= WNOHANG;
25+ retry:
26+ if (wcontinued_not_supported)
27+ waitpid_flags &= ~WCONTINUED;
28 pid = WAITPID (-1, &status, waitpid_flags);
29+ if (errno == EINVAL)
30+ {
31+ wcontinued_not_supported = 1;
32+ goto retry;
33+ }
34
35 /* The check for WNOHANG is to make sure we decrement sigchld only
36 if it was non-zero before we called waitpid. */
Note: See TracBrowser for help on using the repository browser.