diff --git a/build/build.c b/build/build.c index 5f99c8db7..10a3d02e2 100644 --- a/build/build.c +++ b/build/build.c @@ -157,8 +157,6 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd); if (!(child = fork())) { - /* NSPR messes with SIGPIPE, reset to default for the kids */ - signal(SIGPIPE, SIG_DFL); errno = 0; (void) execvp(argv[0], (char *const *)argv); diff --git a/build/rpmfc.c b/build/rpmfc.c index 1c096f862..d6eba1155 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -269,8 +269,6 @@ static StringBuf getOutputFrom(ARGV_t argv, child = fork(); if (child == 0) { - /* NSPR messes with SIGPIPE, reset to default for the kids */ - signal(SIGPIPE, SIG_DFL); close(toProg[1]); close(fromProg[0]); diff --git a/cliutils.c b/cliutils.c index 355ca5296..772a105ec 100644 --- a/cliutils.c +++ b/cliutils.c @@ -55,7 +55,6 @@ int initPipe(void) } if (!(pipeChild = fork())) { - (void) signal(SIGPIPE, SIG_DFL); (void) close(p[1]); (void) dup2(p[0], STDIN_FILENO); (void) close(p[0]); diff --git a/lib/rpmscript.c b/lib/rpmscript.c index 6f6f74662..630171a99 100644 --- a/lib/rpmscript.c +++ b/lib/rpmscript.c @@ -162,6 +162,7 @@ static void doScriptExec(ARGV_const_t argv, ARGV_const_t prefixes, int xx; int open_max; + /* SIGPIPE is ignored in rpm, reset to default for the scriptlet */ (void) signal(SIGPIPE, SIG_DFL); /* XXX Force FD_CLOEXEC on all inherited fdno's. */ diff --git a/rpmio/digest_nss.c b/rpmio/digest_nss.c index f533bb571..992d9acf6 100644 --- a/rpmio/digest_nss.c +++ b/rpmio/digest_nss.c @@ -53,6 +53,9 @@ int rpmInitCrypto(void) * a private context if possible. */ if (!_crypto_initialized) { + /* NSPR sets SIGPIPE to ignore behind our back, save and restore */ + struct sigaction oact; + sigaction(SIGPIPE, NULL, &oact); #if HAVE_NSS_INITCONTEXT PRUint32 flags = (NSS_INIT_READONLY|NSS_INIT_NOCERTDB| NSS_INIT_NOMODDB|NSS_INIT_FORCEOPEN| @@ -67,6 +70,7 @@ int rpmInitCrypto(void) } else { _crypto_initialized = 1; } + sigaction(SIGPIPE, &oact, NULL); } /* Register one post-fork handler per process */