1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 20:25:25 +03:00

resolved: let config_parse() open the configuration file for us

This commit is contained in:
Lennart Poettering 2014-07-07 23:03:17 +02:00
parent de48d5ab62
commit 987d561fe2

View File

@ -97,23 +97,13 @@ int config_parse_dnsv(
}
static int manager_parse_config_file(Manager *m) {
static const char fn[] = "/etc/systemd/resolved.conf";
_cleanup_fclose_ FILE *f = NULL;
int r;
assert(m);
f = fopen(fn, "re");
if (!f) {
if (errno == ENOENT)
return 0;
log_warning("Failed to open configuration file %s: %m", fn);
return -errno;
}
r = config_parse(NULL, fn, f, "Resolve\0", config_item_perf_lookup,
(void*) resolved_gperf_lookup, false, false, m);
r = config_parse(NULL, "/etc/systemd/resolved.conf", NULL,
"Resolve\0", config_item_perf_lookup, (void*) resolved_gperf_lookup,
false, false, m);
if (r < 0)
log_warning("Failed to parse configuration file: %s", strerror(-r));