mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +01:00
alsactl: Do not access other cards than specified for init
When the global state does not exist, alsactl tries to initialize all soundcards. It is not good when alsactl is called multiple times from udev. Also, selinux can deny access to non-existent devices. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
05d3bed5cd
commit
f7eb87ddc7
1 changed files with 12 additions and 2 deletions
|
@ -1646,13 +1646,23 @@ int load_state(const char *file, const char *initfile, const char *cardname,
|
|||
|
||||
error("Cannot open %s for reading: %s", file, snd_strerror(err));
|
||||
finalerr = err;
|
||||
if (cardname) {
|
||||
card = snd_card_get_index(cardname);
|
||||
if (card < 0) {
|
||||
error("Cannot find soundcard '%s'...", cardname);
|
||||
return -ENODEV;
|
||||
}
|
||||
goto single;
|
||||
} else {
|
||||
card = -1;
|
||||
}
|
||||
/* find each installed soundcards */
|
||||
while (1) {
|
||||
while (!cardname) {
|
||||
if (snd_card_next(&card) < 0)
|
||||
break;
|
||||
if (card < 0)
|
||||
break;
|
||||
single:
|
||||
first = 0;
|
||||
if (!do_init)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue