[Python-checkins] python/dist/src/Modules ossaudiodev.c,1.25,1.26

gward@users.sourceforge.net gward@users.sourceforge.net
Thu, 03 Apr 2003 17:47:45 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv13667/Modules

Modified Files:
	ossaudiodev.c 
Log Message:
Use fcntl() to put the audio device *back* into blocking mode after
opening it in non-blocking mode.  Both Guido and David Hammerton have
reported that this fixes their problems with ossaudiodev -- hooray!


Index: ossaudiodev.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ossaudiodev.c	11 Mar 2003 16:53:13 -0000	1.25
--- ossaudiodev.c	4 Apr 2003 01:47:42 -0000	1.26
***************
*** 140,143 ****
--- 140,152 ----
          return NULL;
      }
+ 
+     /* And (try to) put it back in blocking mode so we get the
+        expected write() semantics. */
+     if (fcntl(fd, F_SETFL, 0) == -1) {
+         close(fd);
+         PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev);
+         return NULL;
+     }
+ 
      if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) {
          PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev);