diff options
author | Michael Vogt <mvo@debian.org> | 2015-04-28 17:55:00 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2015-04-28 17:55:00 +0200 |
commit | 15901516326737a67f2a9af26cd7e434162de019 (patch) | |
tree | d9ad50c5fa43943c409fed2e7e8d476f4603fd42 /apt-pkg/contrib | |
parent | 3a53f6a1510d332e24c3330a69b987f2341d1a94 (diff) |
Move sysconf(_SC_OPEN_MAX); out of the for() loop to avoid unneeded syscalls
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 1ba4674e5..1e6d96fe9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -778,8 +778,9 @@ pid_t ExecFork(std::set<int> KeepFDs) signal(SIGCONT,SIG_DFL); signal(SIGTSTP,SIG_DFL); + long ScOpenMax = sysconf(_SC_OPEN_MAX); // Close all of our FDs - just in case - for (int K = 3; K != sysconf(_SC_OPEN_MAX); K++) + for (int K = 3; K != ScOpenMax; K++) { if(KeepFDs.find(K) == KeepFDs.end()) fcntl(K,F_SETFD,FD_CLOEXEC); |