]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: cleanup get_config_net_veth_ipv4_route()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 9 Dec 2020 08:30:18 +0000 (09:30 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 9 Dec 2020 14:01:48 +0000 (15:01 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 4391ff5c9fe761a4f2eb90fba5d4126eed44c780..7714671b2f3817dadd3d934f87cbe249045ee770 100644 (file)
@@ -6061,7 +6061,7 @@ static int get_config_net_veth_ipv4_route(const char *key, char *retv, int inlen
                memset(retv, 0, inlen);
 
        if (!netdev)
-               return ret_set_errno(-1, EINVAL);
+               return ret_errno(EINVAL);
 
        if (netdev->type != LXC_NET_VETH)
                return 0;
@@ -6070,7 +6070,8 @@ static int get_config_net_veth_ipv4_route(const char *key, char *retv, int inlen
 
        lxc_list_for_each(it, &netdev->priv.veth_attr.ipv4_routes) {
                struct lxc_inetdev *i = it->elem;
-               inet_ntop(AF_INET, &i->addr, buf, sizeof(buf));
+               if (!inet_ntop(AF_INET, &i->addr, buf, sizeof(buf)))
+                       return -errno;
                strprint(retv, inlen, "%s/%u%s", buf, i->prefix,
                         (listlen-- > 1) ? "\n" : "");
        }