Ignore SIGPIPE signals during execucton of scriptlets (rhbz:1264198)

This commit is contained in:
Lubos Kardos 2015-10-30 14:42:32 +01:00
parent 5e94633660
commit 90d8cc1648
1 changed files with 11 additions and 0 deletions

View File

@ -271,6 +271,7 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
const char *line;
char *mline = NULL;
rpmRC rc = RPMRC_FAIL;
struct sigaction newact, oldact;
rpmlog(RPMLOG_DEBUG, "%s: scriptlet start\n", sname);
@ -318,6 +319,12 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
goto exit;
}
/* Ignore SIGPIPE during execution of scriptlets */
sigemptyset(&newact.sa_mask);
newact.sa_flags = 0;
newact.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &newact, &oldact);
pid = fork();
if (pid == (pid_t) -1) {
rpmlog(RPMLOG_ERR, _("Couldn't fork %s: %s\n"),
@ -428,6 +435,10 @@ exit:
free(fn);
}
free(mline);
/* Restore SIGPIPE handler */
sigaction(SIGPIPE, &oldact, NULL);
return rc;
}