- Ignore SIGPIPE signals during execucton of scriptlets

- Resolves: #1264198
This commit is contained in:
Lubos Kardos 2015-11-09 09:30:52 +01:00
parent 17475305ec
commit 2f396c1ab4
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 90d8cc16486479441477e89c2e09bd4f9f7604bb Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Fri, 30 Oct 2015 14:42:32 +0100
Subject: [PATCH] Ignore SIGPIPE signals during execucton of scriptlets
(rhbz:1264198)
---
lib/rpmscript.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index 493f4f2..98d3f42 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -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;
}
--
1.9.3

View File

@ -29,7 +29,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}5%{?dist}
Release: %{?snapver:0.%{snapver}.}6%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@ -55,6 +55,7 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
Patch100: rpm-4.13.0-rc1-Fix-new-richdep-syntax.patch
Patch101: rpm-4.13.0-selinux--permissive-scriptlets.patch
Patch102: rpm-4.13.0-unsupported-keys.patch
Patch103: rpm-4.13.0-ignore-sigpipe.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -557,6 +558,9 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Mon Nov 09 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.6
- Ignore SIGPIPE signals during execucton of scriptlets (#1264198)
* Fri Nov 06 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.5
- Fix SIGSEGV in case of old unsupported gpg keys (#1277464)