source: patches/bash-3.0-avoid_WCONTINUED_if_invalid.patch@ 873009c

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 873009c was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • 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.