From: Matthias Günther Date: Sun, 30 May 2010 18:44:11 +0000 (+0200) Subject: apt-pkg/deb/dpkgpm.cc: Fix segmentation fault when /var/log/apt ist missing. X-Git-Tag: 0.9.13.exp1ubuntu1~286^2 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/a7a2824bad5fd9c868f4774771ec9fb2f1895285 apt-pkg/deb/dpkgpm.cc: Fix segmentation fault when /var/log/apt ist missing. LP: #535509 --- diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 18c731788..036f0e385 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -653,6 +653,11 @@ bool pkgDPkgPM::CloseLog() } term_out = NULL; + // check if the directory exists in which we want to write the file + string const logdir = _config->FindDir("Dir::Log"); + if(not FileExists(logdir)) + return _error->Error(_("Directory '%s' missing"), logdir.c_str()); + string history_name = flCombine(_config->FindDir("Dir::Log"), _config->Find("Dir::Log::History")); if (!history_name.empty())