Просмотр исходного кода

* 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)

Arch Librarian лет назад: 22
Родитель
Сommit
7f9a6360fd
2 измененных файлов с 11 добавлено и 5 удалено
  1. 9 5
      apt-pkg/deb/dpkgpm.cc
  2. 2 0
      debian/changelog

+ 9 - 5
apt-pkg/deb/dpkgpm.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    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 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 to all processes in the group. Since dpkg ignores the signal 
 	 it doesn't die but we do! So we must also ignore it */
 	 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
       // Fork dpkg
       pid_t Child = ExecFork();
       pid_t Child = ExecFork();
@@ -479,12 +479,16 @@ bool pkgDPkgPM::Go()
 	 if (errno == EINTR)
 	 if (errno == EINTR)
 	    continue;
 	    continue;
 	 RunScripts("DPkg::Post-Invoke");
 	 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");
 	 return _error->Errno("waitpid","Couldn't wait for subprocess");
       }
       }
 
 
       // Restore sig int/quit
       // 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.
       // Check for an error code.
       if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
       if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ apt (0.5.22) unstable; urgency=low
   * Fix apt-get's suggests/recommends printing, which was skipping every
   * Fix apt-get's suggests/recommends printing, which was skipping every
     other dependency due to both using GlobOr and incrementing the DepIterator
     other dependency due to both using GlobOr and incrementing the DepIterator
     (Closes: #229722)
     (Closes: #229722)
+  * Restore SIGINT/SIGQUIT handlers to their old values (rather than
+    SIG_DFL) after invoking dpkg (Closes: #229854)
 
 
  --
  --