From: Michael Vogt Date: Tue, 28 Aug 2007 08:02:45 +0000 (+0200) Subject: * merged from dpkg-log branch X-Git-Tag: 0.7.21~246 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/f3f7e00a6269af5d3d0ce3785765dc562be7941d?ds=inline;hp=-c * merged from dpkg-log branch --- f3f7e00a6269af5d3d0ce3785765dc562be7941d diff --combined apt-pkg/deb/dpkgpm.cc index 8eddc04ca,343e3d82f..bb7e4b40a --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@@ -44,8 -44,7 +44,8 @@@ using namespace std // --------------------------------------------------------------------- /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) - : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), PackagesDone(0) + : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesDone(0), + PackagesTotal(0), term_out(NULL) { } /*}}}*/ @@@ -352,7 -351,7 +352,7 @@@ void pkgDPkgPM::DoStdin(int master /* * read the terminal pty and write log */ -void pkgDPkgPM::DoTerminalPty(int master, FILE *term_out) +void pkgDPkgPM::DoTerminalPty(int master) { char term_buf[1024] = {0,}; @@@ -568,6 -567,7 +568,6 @@@ bool pkgDPkgPM::Go(int OutStatusFd return _error->Error(_("Directory '%s' missing"), logdir.c_str()); string logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); - FILE *term_out = NULL; if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); @@@ -778,6 -778,9 +778,6 @@@ int _dpkgin = fd[0]; close(fd[1]); // close the write end of the pipe - // the read buffers for the communication with dpkg - char buf[2] = {0,0}; - // the result of the waitpid call int res; if(slave > 0) @@@ -810,13 -813,14 +810,14 @@@ tv.tv_sec = 1; tv.tv_usec = 0; select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); - if (select_ret < 0) + if (select_ret < 0) { std::cerr << "Error in select()" << std::endl; - else if (select_ret == 0) + continue; + } else if (select_ret == 0) continue; if(master >= 0 && FD_ISSET(master, &rfds)) - DoTerminalPty(master, term_out); + DoTerminalPty(master); if(master >= 0 && FD_ISSET(0, &rfds)) DoStdin(master); if(FD_ISSET(_dpkgin, &rfds))