summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/contrib/fileutl.cc15
-rw-r--r--debian/changelog1
2 files changed, 15 insertions, 1 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 14c0b561f..4dc087983 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1022,6 +1022,11 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
#ifdef HAVE_ZLIB
else if (compressor.Name == "gzip")
{
+ if (d->gz != NULL)
+ {
+ gzclose(d->gz);
+ d->gz = NULL;
+ }
if ((Mode & ReadWrite) == ReadWrite)
d->gz = gzdopen(iFd, "r+");
else if ((Mode & WriteOnly) == WriteOnly)
@@ -1037,6 +1042,11 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
#ifdef HAVE_BZ2
else if (compressor.Name == "bzip2")
{
+ if (d->bz2 != NULL)
+ {
+ BZ2_bzclose(d->bz2);
+ d->bz2 = NULL;
+ }
if ((Mode & ReadWrite) == ReadWrite)
d->bz2 = BZ2_bzdopen(iFd, "r+");
else if ((Mode & WriteOnly) == WriteOnly)
@@ -1050,14 +1060,17 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
}
#endif
+ // collect zombies here in case we reopen
+ if (d->compressor_pid > 0)
+ ExecWait(d->compressor_pid, "FileFdCompressor", true);
if ((Mode & ReadWrite) == ReadWrite)
return _error->Error("ReadWrite mode is not supported for file %s", FileName.c_str());
bool const Comp = (Mode & WriteOnly) == WriteOnly;
- // Handle 'decompression' of empty files
if (Comp == false)
{
+ // Handle 'decompression' of empty files
struct stat Buf;
fstat(iFd, &Buf);
if (Buf.st_size == 0 && S_ISFIFO(Buf.st_mode) == false)
diff --git a/debian/changelog b/debian/changelog
index 6b9ba6769..8b052e234 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,7 @@ apt (0.9.3) UNRELEASED; urgency=low
- ensure that we do init d only once and especially not with its own
content as this causes some "interesting" hickups resulting in segfaults
as it seems (Closes: #554387, #670979)
+ - collect zombie (de)compressor processes on reopen
* apt-pkg/aptconfiguration.cc:
- use NULL instead of "" for no (un)compress parameters