diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-10-21 17:12:39 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2025-10-21 17:12:39 +0000 |
| commit | 3e65bcea24f5e77cb27d7eb81f7d92c1b0c3915c (patch) | |
| tree | 4d7562b64206a52f6f7918be422b080f239a8d56 /apt-pkg/install-progress.cc | |
| parent | cb8df17ff8e59192ae2ab864006eea120d408a7a (diff) | |
| parent | bb1e6834e8a1cd6fd5b88b5a1962e9d813a080fc (diff) | |
Merge branch 'close-range-2' into 'main'
ExecFork: Simplify closing and make it safe
See merge request apt-team/apt!525
Diffstat (limited to 'apt-pkg/install-progress.cc')
| -rw-r--r-- | apt-pkg/install-progress.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index fe3324426..6ff8c3140 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -98,7 +98,8 @@ void PackageManagerProgressFd::StartDpkg() // FIXME: use SetCloseExec here once it taught about throwing // exceptions instead of doing _exit(100) on failure - fcntl(OutStatusFd,F_SETFD,FD_CLOEXEC); + if (auto flags = fcntl(OutStatusFd, F_GETFD); flags >= 0) + fcntl(OutStatusFd, F_SETFD, flags | FD_CLOEXEC); // send status information that we are about to fork dpkg WriteToStatusFd(GetProgressFdString("pmstatus", "dpkg-exec", StepsDone, StepsTotal, _("Running dpkg"))); @@ -180,7 +181,8 @@ void PackageManagerProgressDeb822Fd::StartDpkg() { // FIXME: use SetCloseExec here once it taught about throwing // exceptions instead of doing _exit(100) on failure - fcntl(OutStatusFd,F_SETFD,FD_CLOEXEC); + if (auto flags = fcntl(OutStatusFd, F_GETFD); flags >= 0) + fcntl(OutStatusFd, F_SETFD, flags | FD_CLOEXEC); WriteToStatusFd(GetProgressDeb822String("progress", nullptr, StepsDone, StepsTotal, _("Running dpkg"))); } |
