git: 0e80798518be - main - mixer(8): Ignore mixer_open() failures for the -a option

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Thu, 23 May 2024 00:58:07 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=0e80798518be673bdad7245b627cb5bd7ec08888

commit 0e80798518be673bdad7245b627cb5bd7ec08888
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-05-23 00:57:25 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-05-23 00:57:25 +0000

    mixer(8): Ignore mixer_open() failures for the -a option
    
    The most likely reason mixer_open() will fail is because either the
    device doesn't exist, or because it is disabled, so there is not reason
    to kill the application. Instead, continue and print the rest of the
    enabled mixers.
    
    PR:             277615
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D45151
---
 usr.sbin/mixer/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c
index 47d8e6359b73..284ea955b7b4 100644
--- a/usr.sbin/mixer/mixer.c
+++ b/usr.sbin/mixer/mixer.c
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
 		for (i = 0; i < n; i++) {
 			(void)snprintf(buf, sizeof(buf), "/dev/mixer%d", i);
 			if ((m = mixer_open(buf)) == NULL)
-				errx(1, "%s: no such mixer", buf);
+				continue;
 			initctls(m);
 			if (sflag)
 				printrecsrc(m, oflag);