git: 470fae965fc2 - releng/15.0 - sndctl(8): Modify vchans only on supported directions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Oct 2025 21:23:35 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=470fae965fc2a458a20cbc1df2710486ae5d536d
commit 470fae965fc2a458a20cbc1df2710486ae5d536d
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-10-22 11:50:55 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-28 21:22:43 +0000
sndctl(8): Modify vchans only on supported directions
Currently mod_play_vchans() and mod_rec_vchans() run unconditionally,
even if the direction (playback, recording) is not supported by the
device. This results in the "autoconv" (see mod_autoconv()) control
failing when run on simplex devices, because we'll be trying to modify
vchans on an unsupported direction.
Test whether the direction is supported and silently move on if it
isn't.
Approved by: re (cperciva)
Sponsored by: The FreeBSD Foundation
MFC after: 4 days
Differential Revision: https://reviews.freebsd.org/D53233
(cherry picked from commit 70b34fbdbea13c006a724844caa53f59e0e53bd0)
(cherry picked from commit e015e079f9db0e1762e4249bdc76abec93213abc)
---
usr.sbin/sndctl/sndctl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/usr.sbin/sndctl/sndctl.c b/usr.sbin/sndctl/sndctl.c
index 156c845481c5..6977f0ab0ebe 100644
--- a/usr.sbin/sndctl/sndctl.c
+++ b/usr.sbin/sndctl/sndctl.c
@@ -830,6 +830,8 @@ mod_play_vchans(struct snd_dev *dp, void *arg)
if (dp->from_user)
return (-1);
+ if (!dp->play.pchans)
+ return (0);
snprintf(buf, sizeof(buf), "dev.pcm.%d.play.vchans", dp->unit);
@@ -873,6 +875,8 @@ mod_rec_vchans(struct snd_dev *dp, void *arg)
if (dp->from_user)
return (-1);
+ if (!dp->rec.pchans)
+ return (0);
snprintf(buf, sizeof(buf), "dev.pcm.%d.rec.vchans", dp->unit);