]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolved-resolv-conf.c
util-lib: don't include fileio.h from fileio-label.h
[thirdparty/systemd.git] / src / resolve / resolved-resolv-conf.c
index edad569acde9d9c3050715fbf0e6f8e14842f1a7..42225572f251206b68d38758d2f10d904363b1ed 100644 (file)
@@ -6,7 +6,6 @@
 #include "alloc-util.h"
 #include "dns-domain.h"
 #include "fd-util.h"
-#include "fileio-label.h"
 #include "fileio.h"
 #include "ordered-set.h"
 #include "resolved-conf.h"
@@ -55,8 +54,8 @@ int manager_check_resolv_conf(const Manager *m) {
                 if (stat(path, &own) >= 0 &&
                     st.st_dev == own.st_dev &&
                     st.st_ino == own.st_ino) {
-                        log_warning("In spite of DNSStubListner= is disabled, /etc/resolv.conf is a symlink to %s, "
-                                    "which expects DNSStubListner= is enabled.", path);
+                        log_warning("DNSStubListener= is disabled, but /etc/resolv.conf is a symlink to %s "
+                                    "which expects DNSStubListener= to be enabled.", path);
                         return -EOPNOTSUPP;
                 }
         }
@@ -89,7 +88,6 @@ static bool file_is_our_own(const struct stat *st) {
 int manager_read_resolv_conf(Manager *m) {
         _cleanup_fclose_ FILE *f = NULL;
         struct stat st;
-        char line[LINE_MAX];
         unsigned n = 0;
         int r;
 
@@ -137,10 +135,19 @@ int manager_read_resolv_conf(Manager *m) {
         dns_server_mark_all(m->dns_servers);
         dns_search_domain_mark_all(m->search_domains);
 
-        FOREACH_LINE(line, f, r = -errno; goto clear) {
+        for (;;) {
+                _cleanup_free_ char *line = NULL;
                 const char *a;
                 char *l;
 
+                r = read_line(f, LONG_LINE_MAX, &line);
+                if (r < 0) {
+                        log_error_errno(r, "Failed to read /etc/resolv.conf: %m");
+                        goto clear;
+                }
+                if (r == 0)
+                        break;
+
                 n++;
 
                 l = strstrip(line);