summaryrefslogtreecommitdiffstats
path: root/Modules/ossaudiodev.c
diff options
context:
space:
mode:
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;