diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-05-09 22:05:18 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-05-09 22:05:18 +0200 |
commit | ba667cf74b94846c0696ae7a27e53b28492554b6 (patch) | |
tree | 46b8ee8121d7893fcedd27975c2470dcb58e9bb1 | |
parent | e29d7e3e1c7bcff54123b9a69f9b0136d4cf1de5 (diff) |
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)
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 11 | ||||
-rw-r--r-- | debian/changelog | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 1cf225329..14c0b561f 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -905,8 +905,6 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress, bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Compressor const &compressor, unsigned long const Perms) { Close(); - d = new FileFdPrivate; - d->openmode = Mode; Flags = AutoClose; if ((Mode & WriteOnly) != WriteOnly && (Mode & (Atomic | Create | Empty | Exclusive)) != 0) @@ -1000,8 +998,6 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compre bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration::Compressor const &compressor, bool AutoClose) { Close(); - d = new FileFdPrivate; - d->openmode = Mode; Flags = (AutoClose) ? FileFd::AutoClose : 0; iFd = Fd; this->FileName = ""; @@ -1015,7 +1011,12 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration: } bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor) { - d->compressor = compressor; + if (d == NULL) + { + d = new FileFdPrivate(); + d->openmode = Mode; + d->compressor = compressor; + } if (compressor.Name == "." || compressor.Binary.empty() == true) return true; #ifdef HAVE_ZLIB diff --git a/debian/changelog b/debian/changelog index b0c74ea31..6b9ba6769 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,9 @@ apt (0.9.3) UNRELEASED; urgency=low for the report. (Closes: #671721) * apt-pkg/contrib/fileutl.cc: - check that the fd which are closed are valid + - 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) * apt-pkg/aptconfiguration.cc: - use NULL instead of "" for no (un)compress parameters |