summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/dpkgpm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r--apt-pkg/deb/dpkgpm.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 3bc31dc37..cb137729d 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -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
@@ -1205,7 +1205,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
// if tcgetattr does not return zero there was a error
// and we do not do any pty magic
- if (tcgetattr(0, &tt) == 0)
+ if (tcgetattr(STDOUT_FILENO, &tt) == 0)
{
ioctl(0, TIOCGWINSZ, (char *)&win);
if (openpty(&master, &slave, NULL, &tt, &win) < 0)
@@ -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;