mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:05:41 +01:00
alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
c9dc401264
commit
3c740d9049
1 changed files with 9 additions and 4 deletions
|
@ -34,6 +34,8 @@ static int sysfs_init(void)
|
||||||
const char *env;
|
const char *env;
|
||||||
char sysfs_test[PATH_SIZE];
|
char sysfs_test[PATH_SIZE];
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&attr_list);
|
||||||
|
|
||||||
env = getenv("SYSFS_PATH");
|
env = getenv("SYSFS_PATH");
|
||||||
if (env) {
|
if (env) {
|
||||||
strlcpy(sysfs_path, env, sizeof(sysfs_path));
|
strlcpy(sysfs_path, env, sizeof(sysfs_path));
|
||||||
|
@ -42,14 +44,17 @@ static int sysfs_init(void)
|
||||||
strlcpy(sysfs_path, "/sys", sizeof(sysfs_path));
|
strlcpy(sysfs_path, "/sys", sizeof(sysfs_path));
|
||||||
dbg("sysfs_path='%s'", sysfs_path);
|
dbg("sysfs_path='%s'", sysfs_path);
|
||||||
|
|
||||||
|
strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
|
||||||
|
strlcat(sysfs_test, "/kernel/uevent_seqnum", sizeof(sysfs_test));
|
||||||
|
if (access(sysfs_test, F_OK)) {
|
||||||
strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
|
strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
|
||||||
strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test));
|
strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test));
|
||||||
if (access(sysfs_test, F_OK)) {
|
if (access(sysfs_test, F_OK)) {
|
||||||
error("sysfs path '%s' is invalid\n", sysfs_path);
|
error("sysfs path '%s' is invalid", sysfs_path);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&attr_list);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue