[PATCH] bug in non-blocking use of sound driver (2nd try)

From: Eric Lammerts (eric@scintilla.utwente.nl)
Date: Tue Feb 01 2000 - 17:41:28 EST


Hi,
This patch hasn't made it in the kernel since I sent it, so here it
goes again (slightly improved; it now removes more code than it
adds).

In the sound drivers that use audio.c, read() and write() return 0
when they should return -EAGAIN. Both 2.2.x and 2.3.x have this
problem.

Eric

--- linux/drivers/sound/audio.c.orig Tue Jan 18 21:27:09 2000
+++ linux/drivers/sound/audio.c Tue Feb 1 23:35:40 2000
@@ -225,7 +225,7 @@
                 if ((err = DMAbuf_getwrbuffer(dev, &dma_buf, &buf_size, !!(file->f_flags & O_NONBLOCK))) < 0)
                 {
                             /* Handle nonblocking mode */
- if ((file->f_flags & O_NONBLOCK) && err == -EAGAIN)
+ if ((file->f_flags & O_NONBLOCK) && err == -EAGAIN && p > 0)
                                 return p; /* No more space. Return # of accepted bytes */
                         return err;
                 }
@@ -305,9 +305,6 @@
                         /*
                          * Nonblocking mode handling. Return current # of bytes
                          */
-
- if ((file->f_flags & O_NONBLOCK) && buf_no == -EAGAIN)
- return p;
 
                         if (p > 0) /* Avoid throwing away data */
                                 return p; /* Return it instead */

-- 
Eric Lammerts <eric@scintilla.utwente.nl>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 21:00:07 EST