diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2007-11-26 15:44:46 -0200 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2007-11-26 15:44:46 -0200 |
commit | 9983591d172ba5ded02b4e697e655429546e4966 (patch) | |
tree | 23535df8d84a635b6144a1fd3b51f9566dce659a /apt-pkg/deb/dpkgpm.cc | |
parent | 60aeb838d1ae47dc66eb862e4bedba065e712de8 (diff) |
* Applied patch from Aurelien Jarno <aurel32@debian.org> to avoid CPU
getting crazy when /dev/null is redirected to stdin (which breaks
buildds), closes: #452858.
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 5a7711a90..d796146fa 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -344,7 +344,10 @@ void pkgDPkgPM::DoStdin(int master) { char input_buf[256] = {0,}; int len = read(0, input_buf, sizeof(input_buf)); - write(master, input_buf, len); + if (len) + write(master, input_buf, len); + else + stdin_is_dev_null = true; } /*}}}*/ // DPkgPM::DoTerminalPty - Read the terminal pty and write log /*{{{*/ @@ -639,6 +642,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) } } + stdin_is_dev_null = false; + // create log OpenLog(); @@ -868,7 +873,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) // wait for input or output here FD_ZERO(&rfds); - FD_SET(0, &rfds); + if (!stdin_is_dev_null) + FD_SET(0, &rfds); FD_SET(_dpkgin, &rfds); if(master >= 0) FD_SET(master, &rfds); |