Update of /cvsroot/alsa/alsa-oss/alsa
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4366/alsa

Modified Files:
        pcm.c 
Log Message:
fixes in select() mangling

Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-oss/alsa/pcm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pcm.c       12 Feb 2004 18:51:37 -0000      1.3
+++ pcm.c       14 Feb 2004 18:42:17 -0000      1.4
@@ -1294,15 +1294,21 @@
                        for (j = 0; j < count; j++) {
                                int fd = ufds[j].fd;
                                unsigned short events = ufds[j].events;
-                               FD_CLR(fd, readfds);
-                               FD_CLR(fd, writefds);
-                               FD_CLR(fd, exceptfds);
-                               if (events & POLLIN)
-                                       FD_SET(fd, readfds);
-                               if (events & POLLOUT)
-                                       FD_SET(fd, writefds);
-                               if (events & (POLLERR|POLLNVAL))
-                                       FD_SET(fd, exceptfds);
+                               if (readfds) {
+                                       FD_CLR(fd, readfds);
+                                       if (events & POLLIN)
+                                               FD_SET(fd, readfds);
+                               }
+                               if (writefds) {
+                                       FD_CLR(fd, writefds);
+                                       if (events & POLLOUT)
+                                               FD_SET(fd, writefds);
+                               }
+                               if (exceptfds) {
+                                       FD_CLR(fd, exceptfds);
+                                       if (events & (POLLERR|POLLNVAL))
+                                               FD_SET(fd, exceptfds);
+                               }
                        }
                }
        }       
@@ -1340,11 +1346,11 @@
                        for (j = 0; j < count; j++) {
                                int fd = ufds[j].fd;
                                revents = 0;
-                               if (FD_ISSET(fd, readfds))
+                               if (readfds && FD_ISSET(fd, readfds))
                                        revents |= POLLIN;
-                               if (FD_ISSET(fd, writefds))
+                               if (writefds && FD_ISSET(fd, writefds))
                                        revents |= POLLOUT;
-                               if (FD_ISSET(fd, exceptfds))
+                               if (exceptfds && FD_ISSET(fd, exceptfds))
                                        revents |= POLLERR;
                                ufds[j].revents = revents;
                        }



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to