Patch for a bug in server/select.c

Bang Jun-Young bjy at mogua.org
Thu May 17 07:31:51 CDT 2001


On Wed, May 16, 2001 at 02:09:39PM -0700, Alexandre Julliard wrote:
> POLLERR and POLLHUP are legitimate results, and you definitely have to
> call the function in that case. POLLNVAL is not supposed to happen,
> unless there is a bug in the fd management. Or does NetBSD set
> POLLNVAL when the file descriptor is -1?  This wouldn't be correct
> according to the Single Unix spec.

According to the manpage, NetBSD implementation of poll(2) is different
from historical one in that a given fd may not cause poll to return with
an error. I'm not sure if this is the case, however. 

Anyway, I'm attaching another patch for it. 

ChangeLog:
	* server/select.c:
	Workaround for a problem that may cause a segfault on NetBSD 
	when the preceding poll returned pollfd.revents with POLLNVAL set.

Jun-Young

-- 
Bang Jun-Young <bjy at mogua.org>

-------------- next part --------------
--- select.c.orig	Tue Jan 25 10:40:27 2000
+++ select.c	Thu May 17 21:20:42 2001
@@ -257,7 +257,11 @@
             int i;
             for (i = 0; i < nb_users; i++)
             {
+#ifdef __NetBSD__
+		if (pollfd[i].revents & !(pollfd[i].revents & POLLNVAL))
+#else		
                 if (pollfd[i].revents)
+#endif		
                 {
                     poll_users[i]->ops->poll_event( poll_users[i], pollfd[i].revents );
                     if (!--ret) break;


More information about the wine-devel mailing list