Commit cabfbbef authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

criu: action-scripts -- Don't access @root_item_pid if not present

It might be nil on predump, so dereference only when present.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@virtuozzo.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 49877012
...@@ -48,10 +48,12 @@ int run_scripts(enum script_actions act) ...@@ -48,10 +48,12 @@ int run_scripts(enum script_actions act)
return -1; return -1;
} }
snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real); if (root_item) {
if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) { snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real);
pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid); if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) {
return -1; pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid);
return -1;
}
} }
list_for_each_entry(script, &opts.scripts, node) { list_for_each_entry(script, &opts.scripts, node) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment