Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Don't clobber the error returned by uiomove() when s...



details:   https://anonhg.NetBSD.org/src/rev/8946814ba9cc
branches:  trunk
changeset: 473572:8946814ba9cc
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jun 07 19:24:38 1999 +0000

description:
Don't clobber the error returned by uiomove() when starting the audio
output (in case we got a partial block).  Fixes PR #7722, from
Antti Kantee <pooka%iki.fi@localhost>.

diffstat:

 sys/dev/audio.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 0b5f84de5545 -r 8946814ba9cc sys/dev/audio.c
--- a/sys/dev/audio.c   Mon Jun 07 18:04:31 1999 +0000
+++ b/sys/dev/audio.c   Mon Jun 07 19:24:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.114 1999/05/30 00:21:08 nathanw Exp $      */
+/*     $NetBSD: audio.c,v 1.115 1999/06/07 19:24:38 thorpej Exp $      */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -1251,7 +1251,7 @@
        struct audio_softc *sc = audio_cd.cd_devs[unit];
        struct audio_ringbuffer *cb = &sc->sc_pr;
        u_char *inp, *einp;
-       int error, s, n, cc, used;
+       int saveerror, error, s, n, cc, used;
 
        DPRINTFN(2,("audio_write: sc=%p(unit=%d) count=%lu used=%d(hi=%d)\n", 
                    sc, unit, (unsigned long)uio->uio_resid, sc->sc_pr.used, 
@@ -1386,8 +1386,14 @@
                        cc = 0;
                cb->needfill = 0;
                cb->copying = 0;
-               if (!sc->sc_pbus && !cb->pause)
-                       error = audiostartp(sc); /* XXX clobbers error */
+               if (!sc->sc_pbus && !cb->pause) {
+                       saveerror = error;
+                       error = audiostartp(sc);
+                       if (saveerror != 0) {
+                               /* Report the first error that occured. */
+                               error = saveerror;
+                       }
+               }
                splx(s);
                if (cc != 0) {
                        DPRINTFN(1, ("audio_write: fill %d\n", cc));



Home | Main Index | Thread Index | Old Index