mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
crtools: add options to specified a log file
Signed-off-by: Andrey Vagin <avagin@openvz.org> Acked-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
ecc2776fc9
commit
650318f4b2
14
crtools.c
14
crtools.c
@@ -253,8 +253,9 @@ int main(int argc, char *argv[])
|
||||
int ret = -1;
|
||||
int opt, idx;
|
||||
int action = -1;
|
||||
int log_inited = 0;
|
||||
|
||||
static const char short_opts[] = "drskf:p:t:hcD:";
|
||||
static const char short_opts[] = "drskf:p:t:hcD:o:";
|
||||
static const struct option long_opts[] = {
|
||||
{ "dump", no_argument, NULL, 'd' },
|
||||
{ "restore", no_argument, NULL, 'r' },
|
||||
@@ -262,9 +263,6 @@ int main(int argc, char *argv[])
|
||||
{ NULL, no_argument, NULL, 0 }
|
||||
};
|
||||
|
||||
if (init_logging())
|
||||
return 1;
|
||||
|
||||
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
|
||||
|
||||
if (argc < 3)
|
||||
@@ -311,12 +309,20 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
if (init_logging(optarg))
|
||||
return 1;
|
||||
log_inited = 1;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if (!log_inited && init_logging(NULL))
|
||||
return 1;
|
||||
|
||||
if (getcwd(image_dir, sizeof(image_dir)) < 0) {
|
||||
pr_perror("can't get currect directory\n");
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user