]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
print error in log if tcgetattr() fails instead of writing
[apt.git] / apt-pkg / deb / dpkgpm.cc
index fd1e6e085231fea7c79b92a68e1cda7be9334e70..0e468b590a8dff59619ecb4823b071a891b04c42 100644 (file)
@@ -423,7 +423,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
 void pkgDPkgPM::DoStdin(int master)
 {
    unsigned char input_buf[256] = {0,}; 
-   ssize_t len = read(0, input_buf, sizeof(input_buf));
+   ssize_t len = read(STDIN_FILENO, input_buf, sizeof(input_buf));
    if (len)
       FileFd::Write(master, input_buf, len);
    else
@@ -1231,6 +1231,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
            tcsetattr(0, TCSAFLUSH, &rtt);
            sigprocmask(SIG_SETMASK, &original_sigmask, 0);
         }
+      } else {
+         const char *s = _("Can not write log, tcgetattr() failed for stdout");
+         fprintf(stderr, "%s", s);
+         if(d->term_out)
+            fprintf(d->term_out, "%s",s); 
       }
        // Fork dpkg
       pid_t Child;