Search $PATH and /usr/sbin for alsactl
The path to alsactl was previously hardcoded because some distros put it in /usr/sbin but don't include that directory in $PATH. Unfortunately other distros put alsactl elsewhere. Let's search $PATH and /usr/sbin to cater for both. Fixes #101.
This commit is contained in:
@@ -14,9 +14,15 @@ static void run_alsactl(
|
|||||||
) {
|
) {
|
||||||
GtkWindow *w = GTK_WINDOW(card->window_main);
|
GtkWindow *w = GTK_WINDOW(card->window_main);
|
||||||
|
|
||||||
|
gchar *alsactl_path = g_find_program_in_path("alsactl");
|
||||||
|
|
||||||
|
if (!alsactl_path)
|
||||||
|
alsactl_path = g_strdup("/usr/sbin/alsactl");
|
||||||
|
|
||||||
gchar *argv[] = {
|
gchar *argv[] = {
|
||||||
"/usr/sbin/alsactl", cmd, card->device, "-f", fn, NULL
|
alsactl_path, cmd, card->device, "-f", fn, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
gchar *stdout;
|
gchar *stdout;
|
||||||
gchar *stderr;
|
gchar *stderr;
|
||||||
gint exit_status;
|
gint exit_status;
|
||||||
@@ -52,6 +58,7 @@ static void run_alsactl(
|
|||||||
g_free(error_message);
|
g_free(error_message);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
g_free(alsactl_path);
|
||||||
g_free(stdout);
|
g_free(stdout);
|
||||||
g_free(stderr);
|
g_free(stderr);
|
||||||
if (error)
|
if (error)
|
||||||
|
|||||||
Reference in New Issue
Block a user