]> git.saurik.com Git - apt.git/commitdiff
apt-pkg/deb/dpkgpm.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Sun, 15 Jul 2007 16:38:22 +0000 (17:38 +0100)
committerMichael Vogt <michael.vogt@ubuntu.com>
Sun, 15 Jul 2007 16:38:22 +0000 (17:38 +0100)
- write current time to log

apt-pkg/deb/dpkgpm.cc

index 0d5e2b415f82dbbc36731b6af1d8556f26d5957e..6270e49f346157097d9455693310b1c32590b155 100644 (file)
@@ -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)