tree-wide: port various parsers over to read_stripped_line()

This commit is contained in:
Lennart Poettering
2023-10-17 14:36:54 +02:00
parent c56cb33f09
commit 0ff6ff2b29
26 changed files with 127 additions and 194 deletions
+3 -5
View File
@@ -325,19 +325,17 @@ static int dhcp4_server_set_dns_from_resolve_conf(Link *link) {
for (;;) {
_cleanup_free_ char *line = NULL;
const char *a;
char *l;
r = read_line(f, LONG_LINE_MAX, &line);
r = read_stripped_line(f, LONG_LINE_MAX, &line);
if (r < 0)
return log_error_errno(r, "Failed to read " PRIVATE_UPLINK_RESOLV_CONF ": %m");
if (r == 0)
break;
l = strstrip(line);
if (IN_SET(*l, '#', ';', 0))
if (IN_SET(*line, '#', ';', 0))
continue;
a = first_word(l, "nameserver");
a = first_word(line, "nameserver");
if (!a)
continue;