source: patches/bash-3.0-avoid_WCONTINUED_if_invalid.patch@ 0ee931e

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 0ee931e 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
  • bash-3.0/jobs.c

    Reported on bug-bash by Tim Waugh <twaugh@redhat.com>
    http://lists.gnu.org/archive/html/bug-bash/2004-09/msg00081.html
    
    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.
    
    old new (this hunk was shorter than expected)  
     
    24712471  PROCESS *child;
    24722472  pid_t pid;
    24732473  int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
     2474  static int wcontinued_not_supported = 0;
    24742475
    24752476  call_set_current = children_exited = 0;
    24762477  last_stopped_job = NO_JOB;
     
    24842485                        : 0;
    24852486      if (sigchld || block == 0)
    24862487        waitpid_flags |= WNOHANG;
     2488    retry:
     2489      if (wcontinued_not_supported)
     2490        waitpid_flags &= ~WCONTINUED;
    24872491      pid = WAITPID (-1, &status, waitpid_flags);
     2492      if (errno == EINVAL)
     2493        {
     2494          wcontinued_not_supported = 1;
     2495          goto retry;
     2496        }
    24882497
    24892498      /* The check for WNOHANG is to make sure we decrement sigchld only
    24902499         if it was non-zero before we called waitpid. */
Note: See TracBrowser for help on using the repository browser.