esound r498 - trunk
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: esound r498 - trunk
- Date: Wed, 30 Jul 2008 15:35:40 +0000 (UTC)
Author: fejj
Date: Wed Jul 30 15:35:40 2008
New Revision: 498
URL: http://svn.gnome.org/viewvc/esound?rev=498&view=rev
Log:
2008-07-30  Jeffrey Stedfast  <fejj novell com>
	* esdlib.c (write_timeout): Check for the existence of POLLERR or
	POLLHUP first. If either is set, abort the write(). We can't
	assume that POLLOUT won't be set if a hang-up occurred.
Modified:
   trunk/ChangeLog
   trunk/esdlib.c
Modified: trunk/esdlib.c
==============================================================================
--- trunk/esdlib.c	(original)
+++ trunk/esdlib.c	Wed Jul 30 15:35:40 2008
@@ -140,18 +140,20 @@
 			rv = poll (pfd, 1, 100);
 		} while (rv == -1 && errno == EINTR);
 		
-		if (rv < 1 || !(pfd[0].revents & POLLOUT)) {
+		if (rv < 1 || (pfd[0].revents & (POLLERR | POLLHUP))) {
 			fcntl (fd, F_SETFL, flags);
 			errno = ETIMEDOUT;
 			return -1;
 		}
 		
-		do {
-			n = write (fd, buf + nwritten, buflen - nwritten);
-		} while (n == -1 && errno == EINTR);
-		
-		if (n > 0)
-			nwritten += n;
+		if (pfd[0].revents & POLLOUT) {
+			do {
+				n = write (fd, buf + nwritten, buflen - nwritten);
+			} while (n == -1 && errno == EINTR);
+			
+			if (n > 0)
+				nwritten += n;
+		}
 	} while (nwritten < buflen);
 	
 	fcntl (fd, F_SETFL, flags);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]