cd85f4765e35bd3a94d6b4b45753c002442c7fe7
[hdw-linux/hdw-linux.git] / packages / base / bash / avoid_wcontinued.patch
1 diff -Naur bash-3.0.orig/jobs.c bash-3.0/jobs.c
2 --- ./jobs.c    2004-10-12 08:50:11.643481280 +0000
3 +++ ./jobs.c    2004-10-12 08:51:35.110792320 +0000
4 @@ -2476,6 +2476,7 @@
5    PROCESS *child;
6    pid_t pid;
7    int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
8 +  static int wcontinued_not_supported = 0;
9  
10    call_set_current = children_exited = 0;
11    last_stopped_job = NO_JOB;
12 @@ -2489,7 +2490,15 @@
13                         : 0;
14        if (sigchld || block == 0)
15         waitpid_flags |= WNOHANG;
16 +    retry:
17 +      if (wcontinued_not_supported)
18 +       waitpid_flags &= ~WCONTINUED;
19        pid = WAITPID (-1, &status, waitpid_flags);
20 +      if (pid == -1 && errno == EINVAL)
21 +       {
22 +         wcontinued_not_supported = 1;
23 +         goto retry;
24 +       }
25  
26        /* The check for WNOHANG is to make sure we decrement sigchld only
27          if it was non-zero before we called waitpid. */