diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-09-24 11:49:45 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-09-24 11:49:45 +0200 |
commit | 3b5a76ae9ae425db6fda4ccc041fbb1e79fffc18 (patch) | |
tree | 5c1a4c1b9c88ab0c428d8d6e01226c2e9b9ad95d | |
parent | f7d6459db697c6dbba8e5d787a817e7721bfb577 (diff) | |
parent | 07b2db9b4b2e543b599db97d75ac2315a1676ad8 (diff) |
* apt-pkg/deb/dpkgpm.cc:
- when tcgetattr() returns non-zero skip all pty magic
(thanks to Simon Richter, closes: #509866)
* apt-inst/contrib/arfile.cc:
- show propper error message for Invalid archive members
-rw-r--r-- | apt-inst/contrib/arfile.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 51 | ||||
-rw-r--r-- | debian/changelog | 7 |
3 files changed, 35 insertions, 25 deletions
diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index e6c63d1ab..8018f4d30 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -87,7 +87,7 @@ bool ARArchive::LoadHeaders() StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false) { delete Memb; - return _error->Error(_("Invalid archive member header")); + return _error->Error(_("Invalid archive member header %s"), Head.Name); } // Check for an extra long name string diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index aec4edc49..f017d53e7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -850,32 +850,35 @@ bool pkgDPkgPM::Go(int OutStatusFd) struct termios tt; struct winsize win; - int master; - int slave; + int master = -1; + int slave = -1; - // FIXME: setup sensible signal handling (*ick*) - tcgetattr(0, &tt); - ioctl(0, TIOCGWINSZ, (char *)&win); - if (openpty(&master, &slave, NULL, &tt, &win) < 0) + // if tcgetattr does not return zero there was a error + // and we do not do any pty magic + if (tcgetattr(0, &tt) == 0) { - const char *s = _("Can not write log, openpty() " - "failed (/dev/pts not mounted?)\n"); - fprintf(stderr, "%s",s); - fprintf(term_out, "%s",s); - master = slave = -1; - } else { - struct termios rtt; - rtt = tt; - cfmakeraw(&rtt); - rtt.c_lflag &= ~ECHO; - // block SIGTTOU during tcsetattr to prevent a hang if - // the process is a member of the background process group - // http://www.opengroup.org/onlinepubs/000095399/functions/tcsetattr.html - sigemptyset(&sigmask); - sigaddset(&sigmask, SIGTTOU); - sigprocmask(SIG_BLOCK,&sigmask, &original_sigmask); - tcsetattr(0, TCSAFLUSH, &rtt); - sigprocmask(SIG_SETMASK, &original_sigmask, 0); + ioctl(0, TIOCGWINSZ, (char *)&win); + if (openpty(&master, &slave, NULL, &tt, &win) < 0) + { + const char *s = _("Can not write log, openpty() " + "failed (/dev/pts not mounted?)\n"); + fprintf(stderr, "%s",s); + fprintf(term_out, "%s",s); + master = slave = -1; + } else { + struct termios rtt; + rtt = tt; + cfmakeraw(&rtt); + rtt.c_lflag &= ~ECHO; + // block SIGTTOU during tcsetattr to prevent a hang if + // the process is a member of the background process group + // http://www.opengroup.org/onlinepubs/000095399/functions/tcsetattr.html + sigemptyset(&sigmask); + sigaddset(&sigmask, SIGTTOU); + sigprocmask(SIG_BLOCK,&sigmask, &original_sigmask); + tcsetattr(0, TCSAFLUSH, &rtt); + sigprocmask(SIG_SETMASK, &original_sigmask, 0); + } } // Fork dpkg diff --git a/debian/changelog b/debian/changelog index 90e5f8de1..9def86ce9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,13 @@ apt (0.7.24) UNRELEASED; urgency=low * doc/style.txt, buildlib/defaults.mak, buildlib/manpage.mak: - fix a few typos in the comments of this files + [ Michael Vogt ] + * apt-pkg/deb/dpkgpm.cc: + - when tcgetattr() returns non-zero skip all pty magic + (thanks to Simon Richter, closes: #509866) + * apt-inst/contrib/arfile.cc: + - show propper error message for Invalid archive members + [ David Kalnischkies ] * doc/Doxyfile.in: - update file with doxygen 1.6.1 (current unstable) |