[CRIU] [PATCH] scripts: Print error value in case of action script fail
Kirill Tkhai
ktkhai at virtuozzo.com
Thu Dec 15 04:29:23 PST 2016
For easier debugging.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/action-scripts.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index e9260f7..9c8b5fd 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -42,7 +42,7 @@ static LIST_HEAD(scripts);
static int run_shell_scripts(const char *action)
{
- int ret = 0;
+ int retval = 0;
struct script *script;
char image_dir[PATH_MAX];
static unsigned env_set = 0;
@@ -80,13 +80,17 @@ static int run_shell_scripts(const char *action)
}
list_for_each_entry(script, &scripts, node) {
+ int err;
pr_debug("\t[%s]\n", script->path);
- ret |= system(script->path);
+ err = system(script->path);
+ if (err)
+ pr_err("Script %s exited with %d\n", script->path, err);
+ retval |= err;
}
unsetenv("CRTOOLS_SCRIPT_ACTION");
- return ret;
+ return retval;
}
int run_scripts(enum script_actions act)
More information about the CRIU
mailing list