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,11 +48,13 @@ int run_scripts(enum script_actions act) ...@@ -48,11 +48,13 @@ int run_scripts(enum script_actions act)
return -1; return -1;
} }
if (root_item) {
snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real); snprintf(root_item_pid, sizeof(root_item_pid), "%d", root_item->pid.real);
if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) { if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) {
pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid); pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid);
return -1; return -1;
} }
}
list_for_each_entry(script, &opts.scripts, node) { list_for_each_entry(script, &opts.scripts, node) {
if (script->path == SCRIPT_RPC_NOTIFY) { if (script->path == SCRIPT_RPC_NOTIFY) {
......
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