[CRIU] [PATCH] crtools: init log after changing directory to work_dir

Pavel Emelyanov xemul at parallels.com
Tue Nov 19 10:40:32 PST 2013


On 11/20/2013 02:38 AM, Ruslan Kuprieiev wrote:
> After set of patches which add --work-dir option we have an issue: logs are created relatively
> to current dir and not relatively to images dir(which is work dir, when --work-dir is not given).
> To solve this lets init log after chdir(work_dir)
> 
> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> ---
>  crtools.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/crtools.c b/crtools.c
> index b680236..7c723a0 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -285,11 +285,6 @@ int main(int argc, char *argv[])
>  	if (work_dir == NULL)
>  		work_dir = imgs_dir;
>  
> -	log_set_loglevel(log_level);
> -
> -	if (log_init(opts.output))
> -		return -1;
> -
>  	if (opts.img_parent)
>  		pr_info("Will do snapshot from %s\n", opts.img_parent);

This messages goes to nowhere.

>  
> @@ -310,6 +305,11 @@ int main(int argc, char *argv[])
>  		return -1;
>  	}
>  
> +	log_set_loglevel(log_level);
> +
> +	if (log_init(opts.output))
> +		return -1;
> +
>  	if (!strcmp(argv[optind], "dump")) {
>  		if (!tree_id)
>  			goto opt_pid_missing;
> 




More information about the CRIU mailing list