Page MenuHomeFreeBSD

mixer(3): Implement mixer_get_path() function
ClosedPublic

Authored by christos on Mon, May 20, 4:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 23, 2:25 AM
Unknown Object (File)
Wed, May 22, 7:26 PM
Unknown Object (File)
Tue, May 21, 6:49 PM
Subscribers

Details

Summary

This is better than hardcoding device paths in mixer applications.

Sponsored by: The FreeBSD Foundation
MFC after: 1 day

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/libmixer/mixer.c
503

With this check buffer size can still be insufficient to hold BASEPATH + unit + '\0'. We should return an error in that case. Maybe check after strlcpy() and sndprintf()?

lib/libmixer/mixer.c
503

It will be insufficient indeed. I added this to make sure it *at least* fits "/dev/mixer". We could bump this to something like BASEPATH + 3 (are we gonna have more than 3-digit units) +'\0'.

lib/libmixer/mixer.c
503

I think there's an upper limit to the possible number of pcm devices somewhere, but I'd suggest to check the return values of strlcpy() and snprintf() instead. That's what they are there for.

christos marked 2 inline comments as done.

Address Florian's comments.

Mention EXAMPLES section in mixer_get_nmixers().

This revision is now accepted and ready to land.Wed, May 22, 12:54 PM