summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-18 17:03:13 +0100
committerLennart Poettering <lennart@poettering.net>2016-11-21 22:58:26 +0100
commitfa105ce6b7ddd94f8a079e825cef32393adb6d45 (patch)
treea653483c6eeca4c85832faa5f487a517d4bc91cb
parent94e9bd571ede5dee3e91672ef5a4af0e31fb447b (diff)
networkd: minor word extraction fixes
Let's make the loops around extract_first_word() be more alike.
-rw-r--r--src/network/networkd-network.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 1b269d15ce..e3a77c2152 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -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;