mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
mixer(8): Use new mixer if we change the default unit
If we use the -d option to change the default unit, close the current
mixer and open the one we set as the default to avoid printing and
applying changes (if any) to the old one.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D43809
(cherry picked from commit 5daa7cf42f)
This commit is contained in:
parent
96a80ca9ba
commit
6ae4ed11c4
1 changed files with 15 additions and 2 deletions
|
|
@ -118,8 +118,21 @@ main(int argc, char *argv[])
|
|||
|
||||
initctls(m);
|
||||
|
||||
if (dflag && set_dunit(m, dunit) < 0)
|
||||
goto parse;
|
||||
if (dflag) {
|
||||
if (set_dunit(m, dunit) < 0)
|
||||
goto parse;
|
||||
else {
|
||||
/*
|
||||
* Open current mixer since we changed the default
|
||||
* unit, otherwise we'll print and apply changes to the
|
||||
* old one.
|
||||
*/
|
||||
(void)mixer_close(m);
|
||||
if ((m = mixer_open(NULL)) == NULL)
|
||||
errx(1, "cannot open default mixer");
|
||||
initctls(m);
|
||||
}
|
||||
}
|
||||
if (sflag) {
|
||||
printrecsrc(m, oflag);
|
||||
(void)mixer_close(m);
|
||||
|
|
|
|||
Loading…
Reference in a new issue