[CRIU] [PATCH] crtools: chdir to work dir before log_init
Pavel Emelyanov
xemul at parallels.com
Tue Nov 19 00:11:02 PST 2013
On 11/19/2013 03:51 PM, 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 chdir to work dir, before log_init.
>
> 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..0565c74 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -285,6 +285,11 @@ int main(int argc, char *argv[])
> if (work_dir == NULL)
> work_dir = imgs_dir;
>
> + if (chdir(work_dir)) {
> + pr_perror("Can't change directory to %s", work_dir);
> + return -1;
> + }
After this line the call to open_image_dir() cannot succeed.
> +
> log_set_loglevel(log_level);
>
> if (log_init(opts.output))
> @@ -305,11 +310,6 @@ int main(int argc, char *argv[])
> }
> }
>
> - if (chdir(work_dir)) {
> - pr_perror("Can't change directory to %s", work_dir);
> - return -1;
> - }
> -
> if (!strcmp(argv[optind], "dump")) {
> if (!tree_id)
> goto opt_pid_missing;
>
More information about the CRIU
mailing list