summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2007-10-29 16:52:30 -0200
committerOtavio Salvador <otavio@ossystems.com.br>2007-10-29 16:52:30 -0200
commit919e5852f297045cdb409143df663ad630b123e8 (patch)
treefa19a3f4d6cdd0b4e214f8237cef58fe455ef1eb /apt-pkg
parent65d3c471aa471a57aa7bda36f2d10bee160bfd0a (diff)
* Applied patch from Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
to add backward support for arches that lacks pselect support, closes: #448406.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index ce4d4b44b..e3fe8d845 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -543,6 +543,27 @@ bool pkgDPkgPM::CloseLog()
return true;
}
+/*{{{*/
+// This implements a racy version of pselect for those architectures
+// that don't have a working implementation.
+// FIXME: Probably can be removed on Lenny+1
+static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, const struct timespec *timeout,
+ const sigset_t *sigmask)
+{
+ sigset_t origmask;
+ struct timeval tv;
+ int retval;
+
+ tv.tv_sec = timeout->tv.tv_sec;
+ tv.tv_usec = timeout->tv.tv_nsec/1000;
+
+ sigprocmask(SIG_SETMASK, &sigmask, &origmask);
+ retval = select(nfds, readfds, writefds, exceptfds, &tv);
+ sigprocmask(SIG_SETMASK, &origmask, 0);
+ return retval;
+}
+/*}}}*/
// DPkgPM::Go - Run the sequence /*{{{*/
// ---------------------------------------------------------------------
@@ -855,6 +876,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
tv.tv_nsec = 0;
select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL,
&tv, &original_sigmask);
+ if (select_ret < 0 && (errno == EINVAL || errno == ENOSYS))
+ select_ret = racy_pselect(max(master, _dpkgin)+1, &rfds, NULL,
+ NULL, &tv, &original_sigmask);
if (select_ret == 0)
continue;
else if (select_ret < 0 && errno == EINTR)