dbus/dbus dbus-sysdeps.c,1.88,1.89

Havoc Pennington hp@freedesktop.org
Thu Jan 20 19:47:23 PST 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv1054/dbus

Modified Files:
	dbus-sysdeps.c 
Log Message:
2005-01-20  Havoc Pennington  <hp@redhat.com>

	* dbus/dbus-sysdeps.c (_dbus_poll): fix several bugs in the
	select() version, patches from Tor Lillqvist



Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- dbus-sysdeps.c	17 Jan 2005 03:53:40 -0000	1.88
+++ dbus-sysdeps.c	21 Jan 2005 03:47:21 -0000	1.89
@@ -1840,40 +1840,41 @@
 
   for (i = 0; i < n_fds; i++)
     {
-      DBusPollFD f = fds[i];
+      DBusPollFD *fdp = fds[i];
 
-      if (f.events & _DBUS_POLLIN)
-	FD_SET (f.fd, &read_set);
+      if (fdp->events & _DBUS_POLLIN)
+	FD_SET (fdp->fd, &read_set);
 
-      if (f.events & _DBUS_POLLOUT)
-	FD_SET (f.fd, &write_set);
+      if (fdp->events & _DBUS_POLLOUT)
+	FD_SET (fdp->fd, &write_set);
 
-      FD_SET (f.fd, &err_set);
+      FD_SET (fdp->fd, &err_set);
 
-      max_fd = MAX (max_fd, f.fd);
+      max_fd = MAX (max_fd, fdp->fd);
     }
     
   tv.tv_sec = timeout_milliseconds / 1000;
   tv.tv_usec = (timeout_milliseconds % 1000) * 1000;
 
-  ready = select (max_fd + 1, &read_set, &write_set, &err_set, &tv);
+  ready = select (max_fd + 1, &read_set, &write_set, &err_set,
+                  timeout_milliseconds < 0 ? NULL : &tv);
 
   if (ready > 0)
     {
       for (i = 0; i < n_fds; i++)
 	{
-	  DBusPollFD f = fds[i];
+	  DBusPollFD *fdp = fds[i];
 
-	  f.revents = 0;
+	  fdp->revents = 0;
 
-	  if (FD_ISSET (f.fd, &read_set))
-	    f.revents |= _DBUS_POLLIN;
+	  if (FD_ISSET (fdp->fd, &read_set))
+	    fdp->revents |= _DBUS_POLLIN;
 
-	  if (FD_ISSET (f.fd, &write_set))
-	    f.revents |= _DBUS_POLLOUT;
+	  if (FD_ISSET (fdp->fd, &write_set))
+	    fdp->revents |= _DBUS_POLLOUT;
 
-	  if (FD_ISSET (f.fd, &err_set))
-	    f.revents |= _DBUS_POLLERR;
+	  if (FD_ISSET (fdp->fd, &err_set))
+	    fdp->revents |= _DBUS_POLLERR;
 	}
     }
 



More information about the dbus-commit mailing list