diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-28 15:51:33 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-06-28 15:51:33 +0100 |
commit | abd9fcaa723093be0476b594932ed8bfb8307ca4 (patch) | |
tree | ea539f5ee1ac751895b09c09c23a0083f888cf47 /apt-pkg/deb/dpkgpm.cc | |
parent | f1ffbc5001afa705e347dcdbcda1c8a54a90372b (diff) | |
parent | 9c76a88155c346666325339c5581a528d70b1f69 (diff) |
merged from lp:~mvo/apt/mvo
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 5ddcd47e9..5fbd1801a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -32,6 +32,8 @@ #include <algorithm> #include <sstream> #include <map> +#include <pwd.h> +#include <grp.h> #include <termios.h> #include <unistd.h> @@ -667,7 +669,13 @@ bool pkgDPkgPM::OpenLog() return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str()); setvbuf(term_out, NULL, _IONBF, 0); SetCloseExec(fileno(term_out), true); - chmod(logfile_name.c_str(), 0600); + struct passwd *pw; + struct group *gr; + pw = getpwnam("root"); + gr = getgrnam("adm"); + if (pw != NULL && gr != NULL) + chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid); + chmod(logfile_name.c_str(), 0644); fprintf(term_out, "\nLog started: %s\n", timestr); } |