summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:55:58 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:55:58 +0000
commit8b5fe26c590774b623f3f84773845c9fdf2f36ed (patch)
treec7d61d435afc1348ddc04227c008ea9229f8ec66 /apt-pkg
parenta0b22b2b5740bc96fb16f96df6a4611ea2f84c29 (diff)
* Added DPkg::FlushSTDIN to control the flushing of std...
Author: jgg Date: 2000-05-13 01:52:38 GMT * Added DPkg::FlushSTDIN to control the flushing of stdin before forking dpkg. Closes: #63991
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index a9982bc34..09cf20440 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.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");