summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-hwdb
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-01-21 10:15:26 +0100
committerLennart Poettering <lennart@poettering.net>2020-01-21 10:15:26 +0100
commitd6bd2bb4441efc556cad2263a3051b1c3a6cebc6 (patch)
tree0052a03f917e7e0528f9461562a88d42f63bf458 /src/libsystemd/sd-hwdb
parent2aecc668878feebf8c88e2d38a657070a8ddb07a (diff)
downloadsystemd-d6bd2bb4441efc556cad2263a3051b1c3a6cebc6.tar.gz
hwdb: fix error numbers passed to log_syntax()
Diffstat (limited to 'src/libsystemd/sd-hwdb')
-rw-r--r--src/libsystemd/sd-hwdb/hwdb-util.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
index 658fa5fbcf..d790e8fd0b 100644
--- a/src/libsystemd/sd-hwdb/hwdb-util.c
+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
@@ -446,7 +446,7 @@ static int insert_data(struct trie *trie, char **match_list, char *line, const c
value = strchr(line, '=');
if (!value)
- return log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
+ return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
"Key-value pair expected but got \"%s\", ignoring", line);
value[0] = '\0';
@@ -457,7 +457,7 @@ static int insert_data(struct trie *trie, char **match_list, char *line, const c
line++;
if (isempty(line + 1) || isempty(value))
- return log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
+ return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
"Empty %s in \"%s=%s\", ignoring",
isempty(line + 1) ? "key" : "value",
line, value);
@@ -517,9 +517,8 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
break;
if (line[0] == ' ') {
- log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
- "Match expected but got indented property \"%s\", ignoring line", line);
- r = -EINVAL;
+ r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
+ "Match expected but got indented property \"%s\", ignoring line", line);
break;
}
@@ -534,9 +533,8 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
case HW_MATCH:
if (len == 0) {
- log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
- "Property expected, ignoring record with no properties");
- r = -EINVAL;
+ r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
+ "Property expected, ignoring record with no properties");
state = HW_NONE;
match_list = strv_free(match_list);
break;
@@ -567,9 +565,8 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
}
if (line[0] != ' ') {
- log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
- "Property or empty line expected, got \"%s\", ignoring record", line);
- r = -EINVAL;
+ r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
+ "Property or empty line expected, got \"%s\", ignoring record", line);
state = HW_NONE;
match_list = strv_free(match_list);
break;
@@ -583,7 +580,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
}
if (state == HW_MATCH)
- log_syntax(NULL, LOG_WARNING, filename, line_number, EINVAL,
+ log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
"Property expected, ignoring record with no properties");
return r;