]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: do not try to import properties on commented out lines
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Aug 2019 21:08:06 +0000 (06:08 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 4 Aug 2019 12:41:47 +0000 (14:41 +0200)
Fixes #13257.

src/udev/udev-rules.c

index 3473a7eb7e5bc1ca2f7e2cde267dcf5d2079d927..1642f105354674746b899f9072332d2ddbb49391 100644 (file)
@@ -1401,8 +1401,10 @@ static int get_property_from_string(char *line, char **ret_key, char **ret_value
         key = skip_leading_chars(line, NULL);
 
         /* comment or empty line */
-        if (IN_SET(key[0], '#', '\0'))
+        if (IN_SET(key[0], '#', '\0')) {
+                *ret_key = *ret_value = NULL;
                 return 0;
+        }
 
         /* split key/value */
         val = strchr(key, '=');
@@ -1429,7 +1431,7 @@ static int get_property_from_string(char *line, char **ret_key, char **ret_value
 
         *ret_key = key;
         *ret_value = val;
-        return 0;
+        return 1;
 }
 
 static int import_parent_into_properties(sd_device *dev, const char *filter) {
@@ -1681,6 +1683,8 @@ static int udev_rule_apply_token_to_event(
                                                      line);
                                 continue;
                         }
+                        if (r == 0)
+                                continue;
 
                         r = device_add_property(dev, key, value);
                         if (r < 0)
@@ -1719,6 +1723,8 @@ static int udev_rule_apply_token_to_event(
                                                      line);
                                 continue;
                         }
+                        if (r == 0)
+                                continue;
 
                         r = device_add_property(dev, key, value);
                         if (r < 0)