]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/nspawn/nspawn-expose-ports.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / nspawn / nspawn-expose-ports.c
index 38245434da8bd202451cae65573a691d119596d6..98eb85081ee4c32fcf09f08cd3c8580840a80472 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -60,17 +59,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)
@@ -211,7 +210,7 @@ int expose_port_watch_rtnl(
                 sd_netlink_message_handler_t handler,
                 union in_addr_union *exposed,
                 sd_netlink **ret) {
-        _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+        _cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
         int fd, r;
 
         assert(event);