summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 17:05:10 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 17:05:10 +0000
commit7f9a6360fdfecf4f0e5a9cffb714ef83b323322f (patch)
tree68fe6ef03c80434ca404c024438431aa6ba86772 /apt-pkg/deb
parentd20333af6b2091df46e78d3f0a34ae8a3e081584 (diff)
* Restore SIGINT/SIGQUIT handlers to their old values (...
Author: mdz Date: 2004-01-27 02:25:01 GMT * Restore SIGINT/SIGQUIT handlers to their old values (rather than SIG_DFL) after invoking dpkg (Closes: #229854)
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/dpkgpm.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 1548a47d4..d80b23132 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: dpkgpm.cc,v 1.27 2003/07/26 00:25:44 mdz Exp $
+// $Id: dpkgpm.cc,v 1.28 2004/01/27 02:25:01 mdz Exp $
/* ######################################################################
DPKG Package Manager - Provide an interface to dpkg
@@ -436,8 +436,8 @@ bool pkgDPkgPM::Go()
it forks scripts. What happens is that when you hit ctrl-c it sends
it to all processes in the group. Since dpkg ignores the signal
it doesn't die but we do! So we must also ignore it */
- signal(SIGQUIT,SIG_IGN);
- signal(SIGINT,SIG_IGN);
+ sighandler_t old_SIGQUIT = signal(SIGQUIT,SIG_IGN);
+ sighandler_t old_SIGINT = signal(SIGINT,SIG_IGN);
// Fork dpkg
pid_t Child = ExecFork();
@@ -479,12 +479,16 @@ bool pkgDPkgPM::Go()
if (errno == EINTR)
continue;
RunScripts("DPkg::Post-Invoke");
+
+ // Restore sig int/quit
+ signal(SIGQUIT,old_SIGQUIT);
+ signal(SIGINT,old_SIGINT);
return _error->Errno("waitpid","Couldn't wait for subprocess");
}
// Restore sig int/quit
- signal(SIGQUIT,SIG_DFL);
- signal(SIGINT,SIG_DFL);
+ signal(SIGQUIT,old_SIGQUIT);
+ signal(SIGINT,old_SIGINT);
// Check for an error code.
if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)