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)
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 = "";
}
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
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