]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-hwdb: allow empty properties
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 Oct 2020 15:12:42 +0000 (17:12 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 Oct 2020 15:12:42 +0000 (17:12 +0200)
So far we didn't allow empty properties, but it makes sense to do so, for
example to distinguish empty data from lack of data. It also makes it easy to
override properties (back to the empty) value for specific cases.

src/libsystemd/sd-hwdb/hwdb-util.c

index 1b642b6851491e84fa1b30d469b02425d97654b2..c2bfcd1d42bcd0bc07815cfca1a085ae0cca9c9a 100644 (file)
@@ -456,10 +456,9 @@ static int insert_data(struct trie *trie, char **match_list, char *line, const c
         while (isblank(line[0]) && isblank(line[1]))
                 line++;
 
-        if (isempty(line + 1) || isempty(value))
+        if (isempty(line + 1))
                 return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
-                                  "Empty %s in \"%s=%s\", ignoring",
-                                  isempty(line + 1) ? "key" : "value",
+                                  "Empty key in \"%s=%s\", ignoring",
                                   line, value);
 
         STRV_FOREACH(entry, match_list)