diff --git a/criu/action-scripts.c b/criu/action-scripts.c index b1f7952a1..a6a11bfc5 100644 --- a/criu/action-scripts.c +++ b/criu/action-scripts.c @@ -29,6 +29,7 @@ int run_scripts(enum script_actions act) int ret = 0; char image_dir[PATH_MAX]; const char *action = action_names[act]; + char root_item_pid[16]; pr_debug("Running %s scripts\n", action); @@ -46,6 +47,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; + } + list_for_each_entry(script, &opts.scripts, node) { if (script->path == SCRIPT_RPC_NOTIFY) { pr_debug("\tRPC\n");