SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0011-alsactl-Do-not-access-other-cards-than-specified-for.patch
Takashi Iwai 3a57fbf7f8 Accepting request 122710 from home:tiwai:branches:multimedia:libs
- backport fix patches from upstream:
  * Some document fixes
  * Improve xrun_sync in alsaloop
  * Add option to dump HW parameters to aplay
  * Add the support for mapped volumes to amixer
  * Add option to tread any xrun as fatal to aplay/arecord
  * configure.in fixes
  * alsactl: Don't access other cards than specified
  * aplay prints Vu-meter to stderr now
  * fix the avail_min setup in alsaloop

OBS-URL: https://build.opensuse.org/request/show/122710
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=52
2012-05-29 09:34:36 +00:00

50 lines
1.3 KiB
Diff

From f7eb87ddc7787e981e6055c9e6f770fc0cd2359a Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 9 May 2012 08:45:47 +0200
Subject: [PATCH 11/13] 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>
---
alsactl/state.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/alsactl/state.c b/alsactl/state.c
index a8b5bd3..fec000d 100644
--- a/alsactl/state.c
+++ b/alsactl/state.c
@@ -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;
- card = -1;
+ 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;
--
1.7.9.2