daandemeyer / rpms / systemd

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