]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: fix error handling and improve comment
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 14 Feb 2021 19:36:25 +0000 (20:36 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 14 Feb 2021 19:36:25 +0000 (20:36 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 6e0765e760909bfc6a3bacfcbf3743424770b6ab..bab1ea228a9d8df26abad584f91945b8e15ef27a 100644 (file)
@@ -131,12 +131,15 @@ static int lxc_try_preserve_namespace(struct lxc_handler *handler,
        ret = strnprintf(handler->nsfd_paths[idx],
                         sizeof(handler->nsfd_paths[idx]), "%s:/proc/%d/fd/%d",
                         ns_info[idx].proc_name, handler->monitor_pid, fd);
+       if (ret < 0)
+               return ret_errno(EIO);
 
-       /* Legacy style argument passing as arguments to hooks. */
+       /*
+        * In case LXC is configured for exposing information to hooks as
+        * argv-style arguments prepare an argv array we can use.
+        */
        handler->hook_argv[handler->hook_argc] = handler->nsfd_paths[idx];
        handler->hook_argc++;
-       if (ret < 0)
-               return ret_errno(EIO);
 
        DEBUG("Preserved %s namespace via fd %d and stashed path as %s",
              ns_info[idx].proc_name, fd, handler->nsfd_paths[idx]);