From 984853899a7f584fe4d0f67fbd48ad32847ec969 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 9 Dec 2020 09:31:30 +0100 Subject: [PATCH] confile: cleanup get_config_net_veth_ipv6_route() Signed-off-by: Christian Brauner --- src/lxc/confile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 4ec66bf94..2f55e6278 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -6140,7 +6140,7 @@ static int get_config_net_ipv6_address(const char *key, char *retv, int inlen, } static int get_config_net_veth_ipv6_route(const char *key, char *retv, int inlen, - struct lxc_conf *c, void *data) + struct lxc_conf *c, void *data) { int len; size_t listlen; @@ -6155,7 +6155,7 @@ static int get_config_net_veth_ipv6_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; @@ -6164,7 +6164,8 @@ static int get_config_net_veth_ipv6_route(const char *key, char *retv, int inlen lxc_list_for_each(it, &netdev->priv.veth_attr.ipv6_routes) { struct lxc_inet6dev *i = it->elem; - inet_ntop(AF_INET6, &i->addr, buf, sizeof(buf)); + if (!inet_ntop(AF_INET6, &i->addr, buf, sizeof(buf))) + return -errno; strprint(retv, inlen, "%s/%u%s", buf, i->prefix, (listlen-- > 1) ? "\n" : ""); } -- 2.47.2