networkd: minor word extraction fixes

Let's make the loops around extract_first_word() be more alike.
This commit is contained in:
Lennart Poettering
2016-11-21 22:58:26 +01:00
parent 94e9bd571e
commit fa105ce6b7
+7 -3
View File
@@ -909,13 +909,14 @@ int config_parse_dhcp_server_dns(
struct in_addr a, *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;
break;
if (inet_pton(AF_INET, w, &a) <= 0) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse DNS server address, ignoring: %s", w);
@@ -929,6 +930,8 @@ int config_parse_dhcp_server_dns(
m[n->n_dhcp_server_dns++] = a;
n->dhcp_server_dns = m;
}
return 0;
}
int config_parse_dhcp_server_ntp(
@@ -956,11 +959,12 @@ int config_parse_dhcp_server_ntp(
struct in_addr a, *m;
r = extract_first_word(&p, &w, NULL, 0);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to extract word, ignoring: %s", rvalue);
return 0;
}
if (r == 0)
return 0;