Problems with OSS

David Gibson david at
Sat Mar 30 21:36:27 EST 2002

On Fri, Mar 29, 2002 at 05:42:18PM +1100, Simon Burton wrote:
> you probably need all three of these:
>     ret=ioctl(dspfd[dev],SNDCTL_DSP_SETFMT,&format); assert(!ret);
>     ret=ioctl(dspfd[dev],SNDCTL_DSP_STEREO,&stereo); assert(!ret);
>     ret=ioctl(dspfd[dev],SNDCTL_DSP_SPEED,&srate); assert(!ret);

As an aside, *don't* use assert()s like this for checking return
values - use them only for debugging.  If this code is compiled with
NDEBUG defined the asserts will become nops and the code will no
longer check the ioctl() return values as it should.

David Gibson			| For every complex problem there is a
david at	| solution which is simple, neat and
				| wrong.  -- H.L. Mencken

More information about the linux mailing list