From: Yu Watanabe Date: Sat, 3 Aug 2019 21:08:06 +0000 (+0900) Subject: udev: do not try to import properties on commented out lines X-Git-Tag: v243-rc2~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41c81c4a626fda0969fc09ddeb8addb7aae6e4d9;p=thirdparty%2Fsystemd.git udev: do not try to import properties on commented out lines Fixes #13257. --- diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 3473a7eb7e5..1642f105354 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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)