chiark / gitweb /
resolved: let config_parse() open the configuration file for us
authorLennart Poettering <lennart@poettering.net>
Mon, 7 Jul 2014 21:03:17 +0000 (23:03 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 7 Jul 2014 21:03:17 +0000 (23:03 +0200)
src/resolve/resolved-manager.c

index 3ed0603..0e2b85b 100644 (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));