Hi Gün,

2009/9/11, Guenter <li...@gknw.net>:

> so would you conclude to revert the patch?

Most probably yes. But first, lets see if the alternative I propose
here also works for Joshua Kwan and it doesn't break havoc on other
systems.

Hi Joshua,

2009/9/11, Joshua Kwan <jk...@vmware.com>:

> > Joshua, which I/O library and version is behaving in this way?
> > Or which OS and version is doing this?
>
> It was a bug reported by one of my coworkers, who is running
> a laptop with some variety of Fedora.

Could you verify if the attached patch works for you?

For once and for all, it should make happy all systems that set
POLLERR or POLLHUP without setting POLLIN or POLLOUT.

On cygwin libcurl's test suite takes less time to finish, but besides
running the test suite I haven't done any more testing.

-- 
-=[Yang]=-
Index: lib/hostares.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/hostares.c,v
retrieving revision 1.51
diff -u -r1.51 hostares.c
--- lib/hostares.c      11 Sep 2009 02:33:06 -0000      1.51
+++ lib/hostares.c      12 Sep 2009 10:48:32 -0000
@@ -169,14 +169,10 @@
   else {
     /* move through the descriptors and ask for processing on them */
     for(i=0; i < num; i++)
-      /*
-       * Following the advice from:
-       * http://lists.danga.com/pipermail/memcached/2003-October/000336.html
-       */
       ares_process_fd(data->state.areschannel,
-                      pfd[i].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP)?
+                      pfd[i].revents & (POLLRDNORM|POLLIN)?
                       pfd[i].fd:ARES_SOCKET_BAD,
-                      pfd[i].revents & (POLLWRNORM|POLLOUT|POLLERR)?
+                      pfd[i].revents & (POLLWRNORM|POLLOUT)?
                       pfd[i].fd:ARES_SOCKET_BAD);
   }
   return nfds;
Index: lib/select.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/select.c,v
retrieving revision 1.52
diff -u -r1.52 select.c
--- lib/select.c        26 May 2008 15:09:28 -0000      1.52
+++ lib/select.c        12 Sep 2009 10:48:33 -0000
@@ -398,6 +398,20 @@
     }
   } while(r == -1);
 
+  if(r < 0)
+    return -1;
+  if(r == 0)
+    return 0;
+
+  for (i = 0; i < nfds; i++) {
+    if(ufds[i].fd == CURL_SOCKET_BAD)
+      continue;
+    if(ufds[i].revents & POLLHUP)
+      ufds[i].revents |= POLLIN;
+    if(ufds[i].revents & POLLERR)
+      ufds[i].revents |= (POLLIN|POLLOUT);
+  }
+
 #else  /* HAVE_POLL_FINE */
 
   FD_ZERO(&fds_read);

Reply via email to