]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: small cleanup to lxc_check_inherited() calls
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 13 May 2020 10:25:25 +0000 (12:25 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 13 May 2020 10:25:25 +0000 (12:25 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 487d83894d7b38a0e666ccf84fb895e5876d8469..ea70464ce78b1597f62bae21017c68eab4c0e644 100644 (file)
@@ -867,7 +867,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
                NULL,
        };
        char **init_cmd = NULL;
-       int keepfds[3] = {-1, -1, -1};
+       int keepfds[3] = {-EBADF, -EBADF, -EBADF};
 
        /* container does exist */
        if (!c)
@@ -1001,8 +1001,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
                keepfds[0] = handler->conf->maincmd_fd;
                keepfds[1] = handler->state_socket_pair[0];
                keepfds[2] = handler->state_socket_pair[1];
-               ret = lxc_check_inherited(conf, true, keepfds,
-                                         sizeof(keepfds) / sizeof(keepfds[0]));
+               ret = lxc_check_inherited(conf, true, keepfds, ARRAY_SIZE(keepfds));
                if (ret < 0)
                        _exit(EXIT_FAILURE);
 
@@ -1092,8 +1091,7 @@ reboot:
        keepfds[0] = handler->conf->maincmd_fd;
        keepfds[1] = handler->state_socket_pair[0];
        keepfds[2] = handler->state_socket_pair[1];
-       ret = lxc_check_inherited(conf, c->daemonize, keepfds,
-                                 sizeof(keepfds) / sizeof(keepfds[0]));
+       ret = lxc_check_inherited(conf, c->daemonize, keepfds, ARRAY_SIZE(keepfds));
        if (ret < 0) {
                lxc_free_handler(handler);
                ret = 1;