[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[patch] libdebian-installer poll()



This patch solves a poll() portability issue on kfreebsd-i386, and
shouldn't affect other archs.

I tested this on kfreebsd-i386, solving an infinite loop.


Cheers,
Luca Favatella
Index: debian/changelog
===================================================================
--- debian/changelog	(.../trunk/packages/libdebian-installer)	(revision 59247)
+++ debian/changelog	(.../branches/d-i/kfreebsd/packages/libdebian-installer)	(revision 59254)
@@ -2,6 +2,10 @@
 
   * Remove a duplicated line from debian/copyright.
 
+  [ Luca Favatella ]
+  * The poll() system call has EOF-related portability issues. Solve them on
+    kfreebsd-i386. Thanks to Colin Watson for the "poll() and EOF" URL.
+
  -- Colin Watson <cjwatson@debian.org>  Thu, 18 Jun 2009 12:40:52 +0100
 
 libdebian-installer (0.63) unstable; urgency=low
Index: src/exec.c
===================================================================
--- src/exec.c	(.../trunk/packages/libdebian-installer)	(revision 59247)
+++ src/exec.c	(.../branches/d-i/kfreebsd/packages/libdebian-installer)	(revision 59254)
@@ -164,7 +164,12 @@
 
         for (i = 0; i < pipes; i++)
         {
+// References: http://www.greenend.org.uk/rjk/2001/06/poll.html
+#if defined(__FreeBSD_kernel__)
+          if ((pollfds[i].revents & POLLIN) && (! (pollfds[i].revents & POLLHUP)))
+#else
           if (pollfds[i].revents & POLLIN)
+#endif
           {
             while (fgets (line, sizeof (line), files[i].file) != NULL)
             {

Reply to: