[CRIU] [PATCH] criu: action-scripts -- Don't access @root_item_pid if not present
Andrew Vagin
avagin at virtuozzo.com
Thu Apr 14 15:27:56 PDT 2016
On Thu, Apr 14, 2016 at 07:04:13PM +0300, Cyrill Gorcunov wrote:
> It might be nil on predump, so dereference only when present.
>
Acked-by: Andrew Vagin <avagin at virtuozzo.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> ---
> criu/action-scripts.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/criu/action-scripts.c b/criu/action-scripts.c
> index db3bfc3..addc833 100644
> --- a/criu/action-scripts.c
> +++ b/criu/action-scripts.c
> @@ -48,10 +48,12 @@ int run_scripts(enum script_actions act)
> return -1;
> }
>
> - snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real);
> - if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) {
> - pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid);
> - return -1;
> + if (root_item) {
> + snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real);
> + if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) {
> + pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid);
> + return -1;
> + }
> }
>
> list_for_each_entry(script, &opts.scripts, node) {
> --
> 2.5.5
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list