summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--scripts/Dpkg/IPC.pm9
2 files changed, 8 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 74a27e6..4386bcf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
- Fix reproducible source package support in Dpkg::Source::Archive, by
sorting the tar contents with --sort=name.
- Prefix private Dpkg::Source::Package::* functions with _.
+ - Defer filehandle closures in Dpkg::IPC::spawn() to avoid double-close.
+ Closes: #839905, #840293
* Packaging:
- Add liblocale-gettext-perl to libdpkg-perl Recommends.
- Wrap and document dependency relationships.
diff --git a/scripts/Dpkg/IPC.pm b/scripts/Dpkg/IPC.pm
index 5172540..3dfbde9 100644
--- a/scripts/Dpkg/IPC.pm
+++ b/scripts/Dpkg/IPC.pm
@@ -282,7 +282,8 @@ sub spawn {
} elsif ($opts{from_handle}) {
open(STDIN, '<&', $opts{from_handle})
or syserr(g_('reopen stdin'));
- close($opts{from_handle}); # has been duped, can be closed
+ # has been duped, can be closed
+ push @{$opts{close_in_child}}, $opts{from_handle};
}
# Redirect STDOUT if needed
if ($opts{to_file}) {
@@ -291,7 +292,8 @@ sub spawn {
} elsif ($opts{to_handle}) {
open(STDOUT, '>&', $opts{to_handle})
or syserr(g_('reopen stdout'));
- close($opts{to_handle}); # has been duped, can be closed
+ # has been duped, can be closed
+ push @{$opts{close_in_child}}, $opts{to_handle};
}
# Redirect STDERR if needed
if ($opts{error_to_file}) {
@@ -300,7 +302,8 @@ sub spawn {
} elsif ($opts{error_to_handle}) {
open(STDERR, '>&', $opts{error_to_handle})
or syserr(g_('reopen stdout'));
- close($opts{error_to_handle}); # has been duped, can be closed
+ # has been duped, can be closed
+ push @{$opts{close_in_child}}, $opts{error_to_handle};
}
# Close some inherited filehandles
close($_) foreach (@{$opts{close_in_child}});