]> git.saurik.com Git - apt.git/commitdiff
* Added DPkg::FlushSTDIN to control the flushing of std...
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:58 +0000 (16:55 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:55:58 +0000 (16:55 +0000)
Author: jgg
Date: 2000-05-13 01:52:38 GMT
* Added DPkg::FlushSTDIN to control the flushing of stdin before
forking dpkg. Closes: #63991

apt-pkg/deb/dpkgpm.cc

index a9982bc3409f32aeafa1da94cd2e0a76780594e7..09cf20440deebb689cdf4173e32f01ac73a0e9a9 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: dpkgpm.cc,v 1.16 1999/12/12 03:48:36 jgg Exp $
+// $Id: dpkgpm.cc,v 1.17 2000/05/13 01:52:38 jgg Exp $
 /* ######################################################################
 
    DPKG Package Manager - Provide an interface to dpkg
@@ -341,19 +341,22 @@ bool pkgDPkgPM::Go()
         if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0)
            _exit(100);
         
-        int Flags,dummy;
-        if ((Flags = fcntl(STDIN_FILENO,F_GETFL,dummy)) < 0)
-           _exit(100);
-        
-        // Discard everything in stdin before forking dpkg
-        if (fcntl(STDIN_FILENO,F_SETFL,Flags | O_NONBLOCK) < 0)
-           _exit(100);
-        
-        while (read(STDIN_FILENO,&dummy,1) == 1);
+        if (_config->FindB("DPkg::FlushSTDIN",true) == true)
+        {
+           int Flags,dummy;
+           if ((Flags = fcntl(STDIN_FILENO,F_GETFL,dummy)) < 0)
+              _exit(100);
+           
+           // Discard everything in stdin before forking dpkg
+           if (fcntl(STDIN_FILENO,F_SETFL,Flags | O_NONBLOCK) < 0)
+              _exit(100);
+           
+           while (read(STDIN_FILENO,&dummy,1) == 1);
+           
+           if (fcntl(STDIN_FILENO,F_SETFL,Flags & (~(long)O_NONBLOCK)) < 0)
+              _exit(100);
+        }
         
-        if (fcntl(STDIN_FILENO,F_SETFL,Flags & (~(long)O_NONBLOCK)) < 0)
-           _exit(100);
-
         /* No Job Control Stop Env is a magic dpkg var that prevents it
            from using sigstop */
         putenv("DPKG_NO_TSTP=yes");