summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-07-15 17:38:22 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-07-15 17:38:22 +0100
commit97efd303643092950042d4f66854c2c1238fa274 (patch)
treed1e62375bc7c8651675ebaabd9cffac00fc41191
parent7fdafa0f344e236aeaeaa67708dbb70e10a80d98 (diff)
downloadapt-97efd303643092950042d4f66854c2c1238fa274.tar.gz
apt-pkg/deb/dpkgpm.cc:
- write current time to log
-rw-r--r--apt-pkg/deb/dpkgpm.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 0d5e2b415..6270e49f3 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -590,7 +590,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
dup2(slave, 1);
dup2(slave, 2);
close(slave);
-
close(fd[0]); // close the read end of the pipe
if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0)
@@ -641,10 +640,20 @@ bool pkgDPkgPM::Go(int OutStatusFd)
close(slave);
fcntl(0, F_SETFL, O_NONBLOCK);
fcntl(master, F_SETFL, O_NONBLOCK);
+
// FIXME: make this a apt config option and add a logrotate file
FILE *term_out = fopen("/var/log/dpkg-out.log","a");
chmod("/var/log/dpkg-out.log", 0600);
-
+ // output current time
+ char outstr[200];
+ time_t t = time(NULL);
+ struct tm *tmp = localtime(&t);
+ strftime(outstr, sizeof(outstr), "%F %T", tmp);
+ fprintf(term_out, "Log started: ");
+ fprintf(term_out, outstr);
+ fprintf(term_out, "\n");
+
+ // setups fds
fd_set rfds;
struct timeval tv;
int select_ret;
@@ -677,8 +686,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
DoStdin(master);
DoTerminalPty(master, term_out);
- //DoDpkgStatusFd();
+ // FIXME: move this into its own function too
+ //DoDpkgStatusFd();
while(true)
{
if(read(_dpkgin, buf, 1) <= 0)