From: Christian Brauner Date: Wed, 9 Dec 2020 08:29:50 +0000 (+0100) Subject: confile: cleanup get_config_net_ipv4_address() X-Git-Tag: lxc-5.0.0~330^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c34105444909ed17e7cd93fca7d7fece0b434923;p=thirdparty%2Flxc.git confile: cleanup get_config_net_ipv4_address() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index b1c922e04..4391ff5c9 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -6030,13 +6030,14 @@ static int get_config_net_ipv4_address(const char *key, char *retv, int inlen, memset(retv, 0, inlen); if (!netdev) - return -1; + return ret_errno(EINVAL); listlen = lxc_list_len(&netdev->ipv4); lxc_list_for_each(it, &netdev->ipv4) { 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" : ""); }