summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/dpkgpm.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-09-24 11:51:27 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-09-24 11:51:27 +0200
commit40cdb71e715cf1c8e6d8201da307f992763f1654 (patch)
treef2409955757210172a47dae68b8c6320dfb02ded /apt-pkg/deb/dpkgpm.cc
parentf98233c1b1e93ef1bb595bfc6e59c74d9e05eb6a (diff)
parent07b2db9b4b2e543b599db97d75ac2315a1676ad8 (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
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r--apt-pkg/deb/dpkgpm.cc51
1 files changed, 27 insertions, 24 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index d6fbfa72e..7daa55a58 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -861,32 +861,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