Skip to content

Commit

Permalink
alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
Browse files Browse the repository at this point in the history
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
perexg committed Nov 25, 2019
1 parent c9dc401 commit 3c740d9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions alsactl/init_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ static int sysfs_init(void)
const char *env;
char sysfs_test[PATH_SIZE];

INIT_LIST_HEAD(&attr_list);

env = getenv("SYSFS_PATH");
if (env) {
strlcpy(sysfs_path, env, sizeof(sysfs_path));
Expand All @@ -43,13 +45,16 @@ static int sysfs_init(void)
dbg("sysfs_path='%s'", sysfs_path);

strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test));
strlcat(sysfs_test, "/kernel/uevent_seqnum", sizeof(sysfs_test));
if (access(sysfs_test, F_OK)) {
error("sysfs path '%s' is invalid\n", sysfs_path);
return -errno;
strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test));
strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test));
if (access(sysfs_test, F_OK)) {
error("sysfs path '%s' is invalid", sysfs_path);
return -errno;
}
}

INIT_LIST_HEAD(&attr_list);
return 0;
}

Expand Down

0 comments on commit 3c740d9

Please sign in to comment.