RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   02-Jul-2007 09:33:37
  Branch: HEAD                             Handle: 2007070208333601

  Modified files:
    rpm/lib                 psm.c
    rpm/rpmio               rpmsq.c

  Log:
    Detect if a script cannot be run because fork(2) failed
    (usually a resource exhaustion situation).
    
    Submitted by: OpenSUSE via Paul Nasrat at rpm.org
    Obtained from: http://hg.rpm.org/rpm?cs=8cc53c3a2f7b

  Summary:
    Revision    Changes     Path
    2.203       +7  -0      rpm/lib/psm.c
    1.22        +1  -0      rpm/rpmio/rpmsq.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.202 -r2.203 psm.c
  --- rpm/lib/psm.c     27 Jun 2007 21:22:52 -0000      2.202
  +++ rpm/lib/psm.c     2 Jul 2007 07:33:36 -0000       2.203
  @@ -914,6 +914,12 @@
       }
       /[EMAIL PROTECTED]@*/
   
  +    if (psm->sq.child == (pid_t)-1) {
  +        rpmError(RPMERR_FORK, _("Couldn't fork %s: %s\n"), sln, 
strerror(errno));
  +        rc = RPMRC_FAIL;
  +        goto exit;
  +    }
  +
       (void) psmWait(psm);
   
     /* XXX filter order dependent multilib "other" arch helper error. */
  @@ -938,6 +944,7 @@
       }
     }
   
  +exit:
       if (freePrefixes) prefixes = hfd(prefixes, ipt);
   
       xx = Fclose(out);        /* XXX dup'd STDOUT_FILENO */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsq.c
  ============================================================================
  $ cvs diff -u -r1.21 -r1.22 rpmsq.c
  --- rpm/rpmio/rpmsq.c 15 Jun 2007 09:32:47 -0000      1.21
  +++ rpm/rpmio/rpmsq.c 2 Jul 2007 07:33:37 -0000       1.22
  @@ -449,6 +449,7 @@
   
       pid = fork();
       if (pid < (pid_t) 0) {           /* fork failed.  */
  +     sq->child = (pid_t)-1;
   /[EMAIL PROTECTED]@*/
        xx = close(sq->pipes[0]);
        xx = close(sq->pipes[1]);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to