mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
util: add a function for running scripts
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
45fa18487d
commit
8e90ed8c4d
17
util.c
17
util.c
@@ -387,3 +387,20 @@ void shfree_last(void *ptr)
|
||||
sh_bytes_left += sh_last_size;
|
||||
sh_last_size = 0;
|
||||
}
|
||||
|
||||
int run_scripts(char *action)
|
||||
{
|
||||
struct script *script;
|
||||
int ret = 0;
|
||||
|
||||
if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) {
|
||||
pr_perror("Can't set CRTOOL_SCRIPT_ACTION=%s\n", action);
|
||||
return -1;
|
||||
}
|
||||
|
||||
list_for_each_entry(script, &opts.scripts, node)
|
||||
ret |= system(script->path);
|
||||
|
||||
unsetenv("CRTOOLS_SCRIPT_ACTION");
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user