summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-11-28 20:04:14 +0100
committerMichael Vogt <mvo@debian.org>2013-11-28 20:04:14 +0100
commit05f4e3b8441a3dc867ea7956736202a93b36e95b (patch)
treeb8c117fd2c139eed91ce86fc785064a16e5908dd /apt-pkg/contrib/fileutl.cc
parent17ab57f41a249fabb15cdbeeff5a5c0942ccf4ac (diff)
parentf832a745920c988188c64ba018d1e2b436627ad5 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: debian/changelog
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index d2be276c7..3a6bdfe2e 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -760,16 +760,13 @@ bool WaitFd(int Fd,bool write,unsigned long timeout)
return true;
}
/*}}}*/
-// ExecFork - Magical fork that sanitizes the context before execing /*{{{*/
+// MergeKeepFdsFromConfiguration - Merge APT::Keep-Fds configuration /*{{{*/
// ---------------------------------------------------------------------
-/* This is used if you want to cleanse the environment for the forked
- child, it fixes up the important signals and nukes all of the fds,
- otherwise acts like normal fork. */
-pid_t ExecFork()
+/* This is used to merge the APT::Keep-Fds with the provided KeepFDs
+ * set.
+ */
+void MergeKeepFdsFromConfiguration(std::set<int> &KeepFDs)
{
- set<int> KeepFDs;
-
- // FIXME: remove looking at APT::Keep-Fds eventually, its a hack
Configuration::Item const *Opts = _config->Tree("APT::Keep-Fds");
if (Opts != 0 && Opts->Child != 0)
{
@@ -782,6 +779,19 @@ pid_t ExecFork()
KeepFDs.insert(fd);
}
}
+}
+ /*}}}*/
+// ExecFork - Magical fork that sanitizes the context before execing /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used if you want to cleanse the environment for the forked
+ child, it fixes up the important signals and nukes all of the fds,
+ otherwise acts like normal fork. */
+pid_t ExecFork()
+{
+ set<int> KeepFDs;
+ // we need to merge the Keep-Fds as external tools like
+ // debconf-apt-progress use it
+ MergeKeepFdsFromConfiguration(KeepFDs);
return ExecFork(KeepFDs);
}