[CRIU] [PATCH] Issue 329: Reducing scope of variables in action-scripts.c
Andrei Vagin
avagin at gmail.com
Fri Mar 15 19:47:46 MSK 2019
you need to move "Issue 329" from the subject to the body,
so the subject will look like this:
action-scripts: Reducing scope of variables
I would like to see a full link to the issue, it is more convinient if
we read the history from a terminal.
On Sat, Mar 09, 2019 at 01:39:19PM +0530, Harshavardhan Unnibhavi wrote:
> Signed-off-by: Harshavardhan Unnibhavi <hvubfoss at gmail.com>
> ---
> criu/action-scripts.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/criu/action-scripts.c b/criu/action-scripts.c
> index 2803ec0f..2f7617c0 100644
> --- a/criu/action-scripts.c
> +++ b/criu/action-scripts.c
> @@ -49,7 +49,6 @@ static int run_shell_scripts(const char *action)
> {
> int retval = 0;
> struct script *script;
> - char image_dir[PATH_MAX];
> static unsigned env_set = 0;
>
> #define ENV_IMGDIR 0x1
> @@ -61,6 +60,7 @@ static int run_shell_scripts(const char *action)
> }
>
> if (!(env_set & ENV_IMGDIR)) {
> + char image_dir[PATH_MAX];
> sprintf(image_dir, "/proc/%ld/fd/%d", (long) getpid(), get_service_fd(IMG_FD_OFF));
> if (setenv("CRTOOLS_IMAGE_DIR", image_dir, 1)) {
> pr_perror("Can't set CRTOOLS_IMAGE_DIR=%s", image_dir);
> @@ -71,10 +71,10 @@ static int run_shell_scripts(const char *action)
>
> if (!(env_set & ENV_ROOTPID) && root_item) {
> int pid;
> - char root_item_pid[16];
>
> pid = root_item->pid->real;
> if (pid != -1) {
> + char root_item_pid[16];
> snprintf(root_item_pid, sizeof(root_item_pid), "%d", pid);
> if (setenv("CRTOOLS_INIT_PID", root_item_pid, 1)) {
> pr_perror("Can't set CRTOOLS_INIT_PID=%s", root_item_pid);
> --
> 2.17.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list