summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-expose-ports.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@users.noreply.github.com>2016-12-06 16:51:45 +0530
committerLennart Poettering <lennart@poettering.net>2016-12-06 12:21:45 +0100
commit10452f7c93c3a492c1f8fdc4a49b65ddc40b27a2 (patch)
tree4f9bff7fdf68acc0a0c7cc9c9b884f433cc945e2 /src/nspawn/nspawn-expose-ports.c
parent5efdbf11d1ef7da72d3de58abecd84edefbaf98a (diff)
core: introduce parse_ip_port (#4825)
1. Listed in TODO. 2. Tree wide replace safe_atou16 with parse_ip_port incase it's used for ports.
Diffstat (limited to 'src/nspawn/nspawn-expose-ports.c')
-rw-r--r--src/nspawn/nspawn-expose-ports.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nspawn/nspawn-expose-ports.c b/src/nspawn/nspawn-expose-ports.c
index 86124b8779..bcaf0aaeaa 100644
--- a/src/nspawn/nspawn-expose-ports.c
+++ b/src/nspawn/nspawn-expose-ports.c
@@ -58,17 +58,17 @@ int expose_port_parse(ExposePort **l, const char *s) {
memcpy(v, e, split - e);
v[split - e] = 0;
- r = safe_atou16(v, &host_port);
- if (r < 0 || host_port <= 0)
+ r = parse_ip_port(v, &host_port);
+ if (r < 0)
return -EINVAL;
- r = safe_atou16(split + 1, &container_port);
+ r = parse_ip_port(split + 1, &container_port);
} else {
- r = safe_atou16(e, &container_port);
+ r = parse_ip_port(e, &container_port);
host_port = container_port;
}
- if (r < 0 || container_port <= 0)
+ if (r < 0)
return -EINVAL;
LIST_FOREACH(ports, p, *l)