]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: cleanup get_config_net_ipv4_address()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 9 Dec 2020 08:29:50 +0000 (09:29 +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 b1c922e04f6c2718ad39d7a706e629b49540b1d0..4391ff5c9fe761a4f2eb90fba5d4126eed44c780 100644 (file)
@@ -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" : "");
        }