diff options
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 11 | ||||
-rwxr-xr-x | test/integration/test-failing-maintainer-scripts | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c52b83c6e..e410594df 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1053,14 +1053,15 @@ void pkgDPkgPM::StartPtyMagic() } // setup the pty and stuff - struct winsize win; + struct winsize win; - // if tcgetattr does not return zero there was a error - // and we do not do any pty magic + // if tcgetattr for both stdin/stdout returns 0 (no error) + // we do the pty magic _error->PushToStack(); - if (tcgetattr(STDOUT_FILENO, &d->tt) == 0) + if (tcgetattr(STDIN_FILENO, &d->tt) == 0 && + tcgetattr(STDOUT_FILENO, &d->tt) == 0) { - if (ioctl(1, TIOCGWINSZ, (char *)&win) < 0) + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&win) < 0) { _error->Errno("ioctl", _("ioctl(TIOCGWINSZ) failed")); } else if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0) diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts index cb82ebc7a..3dd7d643e 100755 --- a/test/integration/test-failing-maintainer-scripts +++ b/test/integration/test-failing-maintainer-scripts @@ -86,7 +86,7 @@ testmyfailure() { testfailure "$@" -o APT::Status-Fd=3 msgtest 'Test for failure message of maintainerscript in' 'console log' local TEST='rootdir/tmp/testfailure.output' - if grep -q 'exit status 29$' "$TEST"; then + if grep -q 'exit status 29' "$TEST"; then msgpass else cat $TEST |