diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-03-26 17:27:47 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-03-26 17:27:47 +0100 |
commit | c5a4be87d94e3f48aad955107bbaf17b0a7c93cc (patch) | |
tree | 2262b35b2cc7edcd3ad0632b761242253131e9e9 | |
parent | 7a511e5d959f59ec6062a84b3a1ae372ff4f8e86 (diff) |
cherry pick -r 1954..1955 lp:~donkult/apt/sid
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 16 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8ecb683d4..18c731788 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -575,35 +575,37 @@ void pkgDPkgPM::WriteHistoryTag(FILE *history_out, string tag, string value) // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() { - string logdir = _config->FindDir("Dir::Log"); + string const logdir = _config->FindDir("Dir::Log"); if(not FileExists(logdir)) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); // get current time char timestr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); + time_t const t = time(NULL); + struct tm const * const tmp = localtime(&t); strftime(timestr, sizeof(timestr), "%F %T", tmp); // open terminal log - string logfile_name = flCombine(logdir, + string const logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); if (term_out == NULL) - return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str()); + return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str()); chmod(logfile_name.c_str(), 0600); fprintf(term_out, "\nLog started: %s\n", timestr); } - // write - string history_name = flCombine(logdir, + // write your history + string const history_name = flCombine(logdir, _config->Find("Dir::Log::History")); if (!history_name.empty()) { FILE *history_out = fopen(history_name.c_str(),"a"); + if (history_out == NULL) + return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str()); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); string remove, purge, install, upgrade, downgrade; diff --git a/debian/changelog b/debian/changelog index 5f5a43098..b26f18153 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ apt (0.7.25.3ubuntu4) UNRELEASED; urgency=low LP: #540228 * cmdline/apt-get.cc, apt-pkg/cdrom.cc: - fix memory leaks in error conditions in DoSource() + * apt-pkg/deb/dpkgpm.cc: + - fix error message construction in OpenLog() -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 26 Mar 2010 16:57:49 +0100 |