From: Christian Brauner Date: Wed, 9 Dec 2020 08:30:18 +0000 (+0100) Subject: confile: cleanup get_config_net_veth_ipv4_route() X-Git-Tag: lxc-5.0.0~330^2~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d4611dc5deaf4e493b9171c97fd3676af27600a;p=thirdparty%2Flxc.git confile: cleanup get_config_net_veth_ipv4_route() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 4391ff5c9..7714671b2 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -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" : ""); }