]> git.saurik.com Git - apt.git/commitdiff
* Applied patch from Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
authorOtavio Salvador <otavio@ossystems.com.br>
Mon, 29 Oct 2007 18:52:30 +0000 (16:52 -0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Mon, 29 Oct 2007 18:52:30 +0000 (16:52 -0200)
  to add backward support for arches that lacks pselect support,
  closes: #448406.

apt-pkg/deb/dpkgpm.cc
debian/changelog

index ce4d4b44ba0dddbce6019d09630fb0a79dab7c1d..e3fe8d845a1e1bcb7cfdb108964a44db034d5231 100644 (file)
@@ -543,6 +543,27 @@ bool pkgDPkgPM::CloseLog()
    return true;
 }
 
    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                                       /*{{{*/
 // ---------------------------------------------------------------------
 
 // 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);
         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)
         if (select_ret == 0) 
            continue;
         else if (select_ret < 0 && errno == EINTR)
index cd14b0caf580bfa7d4632467612071cfdee01b3c..36c7aa2c24776ad2567924450b9cf80568799dd4 100644 (file)
@@ -12,8 +12,11 @@ apt (0.7.9) UNRELEASED; urgency=low
 
   [ Otavio Salvador ]
   * Fix configure script to check for CURL library and headers presense.
 
   [ Otavio Salvador ]
   * Fix configure script to check for CURL library and headers presense.
+  * Applied patch from Brian M. Carlson <sandals@crustytoothpaste.ath.cx>
+    to add backward support for arches that lacks pselect support,
+    closes: #448406.
 
 
- -- Otavio Salvador <otavio@debian.org>  Mon, 29 Oct 2007 10:15:52 -0200
+ -- Otavio Salvador <otavio@debian.org>  Mon, 29 Oct 2007 15:53:32 -0200
 
 apt (0.7.8) unstable; urgency=low
 
 
 apt (0.7.8) unstable; urgency=low