summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-03-12 10:56:25 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-03-12 10:56:25 +0100
commit569cc9349d26cc6a886111023df21ba569b1ffbe (patch)
tree19221f1e41f0afd11a5eb9b383012acf5d23a68b
parentcf0e078c440226e0009bb861486b974a03842f7b (diff)
* apt-pkg/deb/dpkgpm.cc:
- fix error message construction in OpenLog()
-rw-r--r--apt-pkg/deb/dpkgpm.cc16
-rw-r--r--debian/changelog2
2 files changed, 11 insertions, 7 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index fb6054f79..ad1ea77fd 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -564,35 +564,37 @@ void pkgDPkgPM::WriteHistoryTag(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())
{
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 417c23e8c..d1983ee9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,8 @@ apt (0.7.26) UNRELEASED; urgency=low
* doc/apt_preferences.5.xml:
- fix two typos and be more verbose in the novice warning.
Thanks to Osamu Aoki for pointing it out! (Closes: #567669)
+ * apt-pkg/deb/dpkgpm.cc:
+ - fix error message construction in OpenLog()
-- David Kalnischkies <kalnischkies@gmail.com> Fri, 19 Feb 2010 21:21:43 +0100