]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.cc: Fix segmentation fault when /var/log/apt ist missing.
[apt.git] / apt-pkg / deb / dpkgpm.cc
index 18c731788f2a3a020f07dcf80d138334248fb898..036f0e3856cac8565332656fd2c38d0b44d3091c 100644 (file)
@@ -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())