summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-10-14 08:42:48 +0200
committerMichael Vogt <mvo@debian.org>2013-10-14 08:42:48 +0200
commit5e9458e285af11c7fa4308add10d250e3546c8bf (patch)
treea3c62859aa031737cb8d7487ca8d742bcd2cba87 /apt-pkg
parenta22fdebf63a42026e4350ebd069512c797bc2a5b (diff)
re-add APT::Keep-Fds:: for the dpkg status-fd in dpkgpm.cc as we always need this
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc6
-rw-r--r--apt-pkg/iprogress.cc9
-rw-r--r--apt-pkg/packagemanager.cc18
3 files changed, 18 insertions, 15 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 36d8c829a..fbb5e4c96 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1264,6 +1264,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
_error->DumpErrors(std::cerr);
_error->RevertToStack();
+ // this is the dpkg status-fd, we need to keep it
+ _config->Set("APT::Keep-Fds::",fd[1]);
+
// Tell the progress that its starting and fork dpkg
d->progress->Start();
pid_t Child = ExecFork();
@@ -1316,6 +1319,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
if (_config->FindB("DPkg::UseIoNice", false) == true)
ionice(Child);
+ // clear the Keep-Fd again
+ _config->Clear("APT::Keep-Fds",fd[1]);
+
// Wait for dpkg
int Status = 0;
diff --git a/apt-pkg/iprogress.cc b/apt-pkg/iprogress.cc
index 7de190da0..bed991d68 100644
--- a/apt-pkg/iprogress.cc
+++ b/apt-pkg/iprogress.cc
@@ -8,7 +8,7 @@
#include <termios.h>
#include <sys/ioctl.h>
#include <sstream>
-
+#include <fcntl.h>
namespace APT {
namespace Progress {
@@ -42,7 +42,12 @@ void PackageManagerProgressFd::WriteToStatusFd(std::string s)
void PackageManagerProgressFd::Start()
{
- _config->Set("APT::Keep-Fds::", OutStatusFd);
+ if(OutStatusFd <= 0)
+ return;
+
+ // FIXME: use SetCloseExec here once it taught about throwing
+ // exceptions instead of doing _exit(100) on failure
+ fcntl(OutStatusFd,F_SETFD,FD_CLOEXEC);
// send status information that we are about to fork dpkg
std::ostringstream status;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 32bc5284e..3690a64c3 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -26,7 +26,6 @@
#include <apt-pkg/sptr.h>
#include <iostream>
-#include <fcntl.h>
#include <apti18n.h>
/*}}}*/
@@ -1034,18 +1033,11 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
pkgPackageManager::OrderResult
pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress)
{
-// FIXME: port to new structure
-#if 0
- if(statusFd > 0)
- // FIXME: use SetCloseExec here once it taught about throwing
- // exceptions instead of doing _exit(100) on failure
- fcntl(statusFd,F_SETFD,FD_CLOEXEC);
-#endif
- bool goResult = Go(progress);
- if(goResult == false)
- return Failed;
-
- return Res;
+ bool goResult = Go(progress);
+ if(goResult == false)
+ return Failed;
+
+ return Res;
};
/*}}}*/
// PM::DoInstall - Does the installation /*{{{*/