File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ needrestart (3.2) unstable; urgency=medium
2020 (github issue #116 by Marc Dequènes (Duck) @duck-rh)
2121 - [L10n] Fix typo in Russian localization.
2222 (github pull request #118 by @bodqhrohro)
23+ - [UI] Do not leak fd into restarted services.
24+ (Debian Bug#893152 by Stephen Rothwell <debbugs@rothwell.id.au>)
2325
2426 -- Thomas Liske <thomas@fiasko-nw.net>
2527
Original file line number Diff line number Diff line change @@ -269,4 +269,20 @@ sub runcmd {
269269 close (STDOUT );
270270}
271271
272+ # Workaround for Debian Bug#893152
273+ #
274+ # Using Debconf leaks a fd to this module's source file. Since Perl seems
275+ # not to set O_CLOEXEC the fd keeps open if the Debconf package uses fork
276+ # to restart needrestart piped to Debconf. The FD will leak into restarted
277+ # daemons if using Sys-V init.
278+ foreach my $fn (</proc/self/fd/*>) {
279+ my $dst = readlink ($fn );
280+
281+ # check if the FD is the package source file
282+ if ($dst && ($dst eq __FILE__ ) && $fn =~ / \/ (\d +)$ / ) {
283+ open (my $fh , " <&=" , $1 ) || warn (" $! \n " );
284+ close ($fh );
285+ }
286+ }
287+
2722881;
You can’t perform that action at this time.
0 commit comments