summaryrefslogtreecommitdiffstats
path: root/Modules/ossaudiodev.c
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2003-04-04 01:47:42 (GMT)
committerGreg Ward <gward@python.net>2003-04-04 01:47:42 (GMT)
commit76ffb1918d31bac2b88f1a63e453802248a5dfc0 (patch)
tree0b3901ab44e4e20f231efaaf10b761070eab9cce /Modules/ossaudiodev.c
parent059b094e29df9727de18d229149a1495baccca46 (diff)
downloadcpython-76ffb1918d31bac2b88f1a63e453802248a5dfc0.zip
cpython-76ffb1918d31bac2b88f1a63e453802248a5dfc0.tar.gz
cpython-76ffb1918d31bac2b88f1a63e453802248a5dfc0.tar.bz2
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!
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r--Modules/ossaudiodev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 0777840..948ffe7 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -139,6 +139,15 @@ newossobject(PyObject *arg)
PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev);
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);
return NULL;