teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.4.2-forkfailed.patch

Paul Nasrat e26647
Print error message if scriptlet fork fails instead if silently
Paul Nasrat e26647
dying. [#152779]
Paul Nasrat e26647
Paul Nasrat e26647
Index: lib/psm.c
Paul Nasrat e26647
===================================================================
Paul Nasrat e26647
--- lib/psm.c.orig
Paul Nasrat e26647
+++ lib/psm.c
Paul Nasrat e26647
@@ -910,6 +910,12 @@ static rpmRC runScript(rpmpsm psm, Heade
Paul Nasrat e26647
     }
Paul Nasrat e26647
     /*@=branchstate@*/
Paul Nasrat e26647
 
Paul Nasrat e26647
+    if (psm->sq.child == (pid_t)-1) {
Paul Nasrat e26647
+	rpmError(RPMERR_FORK, _("Couldn't fork %s: %s\n"), sln, strerror(errno));
Paul Nasrat e26647
+	rc = RPMRC_FAIL;
Paul Nasrat e26647
+	goto exit;
Paul Nasrat e26647
+    }
Paul Nasrat e26647
+
Paul Nasrat e26647
     (void) psmWait(psm);
Paul Nasrat e26647
 
Paul Nasrat e26647
   /* XXX filter order dependent multilib "other" arch helper error. */
Paul Nasrat e26647
@@ -934,6 +940,7 @@ static rpmRC runScript(rpmpsm psm, Heade
Paul Nasrat e26647
     }
Paul Nasrat e26647
   }
Paul Nasrat e26647
 
Paul Nasrat e26647
+exit:
Paul Nasrat e26647
     if (freePrefixes) prefixes = hfd(prefixes, ipt);
Paul Nasrat e26647
 
Paul Nasrat e26647
     xx = Fclose(out);	/* XXX dup'd STDOUT_FILENO */
Paul Nasrat e26647
Index: rpmio/rpmsq.c
Paul Nasrat e26647
===================================================================
Paul Nasrat e26647
--- rpmio/rpmsq.c.orig
Paul Nasrat e26647
+++ rpmio/rpmsq.c
Paul Nasrat e26647
@@ -407,6 +407,7 @@ fprintf(stderr, "    Enable(%p): %p\n", 
Paul Nasrat e26647
 
Paul Nasrat e26647
     pid = fork();
Paul Nasrat e26647
     if (pid < (pid_t) 0) {		/* fork failed.  */
Paul Nasrat e26647
+	sq->child = (pid_t)-1;
Paul Nasrat e26647
 /*@-bounds@*/
Paul Nasrat e26647
 	xx = close(sq->pipes[0]);
Paul Nasrat e26647
 	xx = close(sq->pipes[1]);