summaryrefslogtreecommitdiff
path: root/src/sysctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-10-25 09:26:10 +0200
committerLennart Poettering <lennart@poettering.net>2016-11-02 11:29:59 -0600
commit98bf5011fe670ea18b7b35d6c8ca3e84d4efbccf (patch)
treea320f696f7cf2883a8633442382d1b90ddf89488 /src/sysctl
parent9c37b41c6166ca511b317255cfad271c906e597a (diff)
sysctl: when failing to process a config line, show line nr
Diffstat (limited to 'src/sysctl')
-rw-r--r--src/sysctl/sysctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index a2a7a10f69..7117955568 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -90,6 +90,7 @@ static bool test_prefix(const char *p) {
static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ignore_enoent) {
_cleanup_fclose_ FILE *f = NULL;
+ unsigned c = 0;
int r;
assert(path);
@@ -115,6 +116,8 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
return log_error_errno(errno, "Failed to read file '%s', ignoring: %m", path);
}
+ c++;
+
p = strstrip(l);
if (!*p)
continue;
@@ -124,7 +127,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
value = strchr(p, '=');
if (!value) {
- log_error("Line is not an assignment in file '%s': %s", path, value);
+ log_error("Line is not an assignment at '%s:%u': %s", path, c, value);
if (r == 0)
r = -EINVAL;
@@ -145,7 +148,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
if (streq(value, existing))
continue;
- log_debug("Overwriting earlier assignment of %s in file '%s'.", p, path);
+ log_debug("Overwriting earlier assignment of %s at '%s:%u'.", p, path, c);
free(ordered_hashmap_remove(sysctl_options, p));
free(v);
}