rpm/rpm-4.4.2-forkfailed.patch

41 lines
1.1 KiB
Diff
Raw Normal View History

Print error message if scriptlet fork fails instead if silently
dying. [#152779]
Index: lib/psm.c
===================================================================
--- lib/psm.c.orig
+++ lib/psm.c
@@ -910,6 +910,12 @@ static rpmRC runScript(rpmpsm psm, Heade
}
/*@=branchstate@*/
+ 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. */
@@ -934,6 +940,7 @@ static rpmRC runScript(rpmpsm psm, Heade
}
}
+exit:
if (freePrefixes) prefixes = hfd(prefixes, ipt);
xx = Fclose(out); /* XXX dup'd STDOUT_FILENO */
Index: rpmio/rpmsq.c
===================================================================
--- rpmio/rpmsq.c.orig
+++ rpmio/rpmsq.c
@@ -407,6 +407,7 @@ fprintf(stderr, " Enable(%p): %p\n",
pid = fork();
if (pid < (pid_t) 0) { /* fork failed. */
+ sq->child = (pid_t)-1;
/*@-bounds@*/
xx = close(sq->pipes[0]);
xx = close(sq->pipes[1]);