[CRIU] [PATCH 2/5] crtools: chdir to images dir after processing all command line options
Ruslan Kuprieiev
kupruser at gmail.com
Tue Nov 12 13:42:58 PST 2013
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
crtools.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/crtools.c b/crtools.c
index 4a0017f..b9313b1 100644
--- a/crtools.c
+++ b/crtools.c
@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
int ret = -1;
int opt, idx;
int log_level = 0;
+ char *imgs_dir = ".";
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
@@ -163,11 +164,7 @@ int main(int argc, char *argv[])
opts.restore_detach = true;
break;
case 'D':
- if (chdir(optarg)) {
- pr_perror("Can't change directory to %s",
- optarg);
- return -1;
- }
+ imgs_dir = optarg;
break;
case 'W':
break;
@@ -283,6 +280,11 @@ int main(int argc, char *argv[])
}
}
+ if (chdir(imgs_dir)) {
+ pr_perror("Can't change directory to %s", optarg);
+ return -1;
+ }
+
log_set_loglevel(log_level);
if (log_init(opts.output))
--
1.8.1.2
More information about the CRIU
mailing list