From: Christian Brauner Date: Sun, 14 Feb 2021 19:36:25 +0000 (+0100) Subject: start: fix error handling and improve comment X-Git-Tag: lxc-5.0.0~288^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb3b010c168459055c6778ab46c832a178cd4260;p=thirdparty%2Flxc.git start: fix error handling and improve comment Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index 6e0765e76..bab1ea228 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -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]);