]> git.saurik.com Git - apt.git/commitdiff
apt-pkg/deb/dpkgpm.cc: Fix segmentation fault when /var/log/apt ist missing.
authorMatthias Günther <matgnt@gmail.com>
Sun, 30 May 2010 18:44:11 +0000 (20:44 +0200)
committerMatthias Günther <matgnt@gmail.com>
Sun, 30 May 2010 18:44:11 +0000 (20:44 +0200)
LP: #535509

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())