summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-08-05 12:55:11 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-09-09 17:19:48 +0200
commit149ee4017c7d21b420b7109ea7606012c9051d15 (patch)
treeddb0bcc0fd8e56a6296b03dbfb403a543964b629 /apt-pkg/deb
parent4d4459a5548e82224aac778833625358c0801681 (diff)
don't write & chmod /dev/null log files
APT by default logs terminal (term.log) and actions (history.log), but if either or Dir::Log directly is set to /dev/null it continues to do so, which isn't too bad – just wasted effort – but term.log is chmodded to protect it from the general public (as it may contain otherwise private data the admin entired in the terminal) which shouldn't happen for /dev/null.
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/dpkgpm.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 58599193e..4724f6e1c 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -984,7 +984,7 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value)
// DPkgPM::OpenLog /*{{{*/
bool pkgDPkgPM::OpenLog()
{
- string const logfile_name = _config->FindFile("Dir::Log::Terminal");
+ string const logfile_name = _config->FindFile("Dir::Log::Terminal", "/dev/null");
string logdir = flNotFile(logfile_name);
if(CreateAPTDirectoryIfNeeded(logdir, logdir) == false)
// FIXME: use a better string after freeze
@@ -998,7 +998,7 @@ bool pkgDPkgPM::OpenLog()
strftime(timestr, sizeof(timestr), "%F %T", tmp);
// open terminal log
- if (!logfile_name.empty())
+ if (logfile_name != "/dev/null")
{
d->term_out = fopen(logfile_name.c_str(),"a");
if (d->term_out == NULL)
@@ -1018,11 +1018,11 @@ bool pkgDPkgPM::OpenLog()
}
// write your history
- string const history_name = _config->FindFile("Dir::Log::History");
+ string const history_name = _config->FindFile("Dir::Log::History", "/dev/null");
string logdir2 = flNotFile(logfile_name);
if(logdir != logdir2 && CreateAPTDirectoryIfNeeded(logdir2, logdir2) == false)
return _error->Error(_("Directory '%s' missing"), logdir.c_str());
- if (!history_name.empty())
+ if (history_name != "/dev/null")
{
d->history_out = fopen(history_name.c_str(),"a");
if (d->history_out == NULL)
@@ -2350,8 +2350,8 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
fflush(d->term_out);
// attach terminal log it if we have it
- string logfile_name = _config->FindFile("Dir::Log::Terminal");
- if (!logfile_name.empty())
+ string logfile_name = _config->FindFile("Dir::Log::Terminal", "/dev/null");
+ if (logfile_name != "/dev/null")
{
FILE *log = NULL;
@@ -2368,8 +2368,8 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
}
// attach history log it if we have it
- string histfile_name = _config->FindFile("Dir::Log::History");
- if (!histfile_name.empty())
+ string histfile_name = _config->FindFile("Dir::Log::History", "/dev/null");
+ if (histfile_name != "/dev/null")
{
fprintf(report, "DpkgHistoryLog:\n");
FILE* log = fopen(histfile_name.c_str(),"r");