richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
be0c12
From 2ab6e6ae9853e410310268efc0cea7f2276979ee Mon Sep 17 00:00:00 2001
be0c12
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
be0c12
Date: Tue, 20 Oct 2020 17:12:42 +0200
be0c12
Subject: [PATCH] sd-hwdb: allow empty properties
be0c12
be0c12
So far we didn't allow empty properties, but it makes sense to do so, for
be0c12
example to distinguish empty data from lack of data. It also makes it easy to
be0c12
override properties (back to the empty) value for specific cases.
be0c12
be0c12
(cherry picked from commit afe87974dd57741f74dd87165b251886f24c859f)
be0c12
be0c12
Related: #2005009
be0c12
---
be0c12
 src/hwdb/hwdb.c | 5 ++---
be0c12
 1 file changed, 2 insertions(+), 3 deletions(-)
be0c12
be0c12
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
be0c12
index 317cad8a67..af085cdb75 100644
be0c12
--- a/src/hwdb/hwdb.c
be0c12
+++ b/src/hwdb/hwdb.c
be0c12
@@ -462,10 +462,9 @@ static int insert_data(struct trie *trie, char **match_list, char *line,
be0c12
         while (isblank(line[0]) && isblank(line[1]))
be0c12
                 line++;
be0c12
 
be0c12
-        if (isempty(line + 1) || isempty(value))
be0c12
+        if (isempty(line + 1))
be0c12
                 return log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
be0c12
-                                  "Empty %s in \"%s=%s\", ignoring",
be0c12
-                                  isempty(line + 1) ? "key" : "value",
be0c12
+                                  "Empty key in \"%s=%s\", ignoring",
be0c12
                                   line, value);
be0c12
 
be0c12
         STRV_FOREACH(entry, match_list)