]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: sysfs - add /sys/kernel/uevent_seqnum check to init
authorJaroslav Kysela <perex@perex.cz>
Wed, 20 Nov 2019 12:20:39 +0000 (13:20 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 25 Nov 2019 17:01:32 +0000 (18:01 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/init_sysfs.c

index 5c789b61b0e542a9e1271456a09e0b801c9e68c4..57ef615a2c76d6650e29e752281c78ec15993e44 100644 (file)
@@ -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));
@@ -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;
 }