teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0637-sd-hwdb-allow-empty-properties.patch

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