[CRIU] [PATCH 1/2] pie/piegen: make -f explicit parameter

Dmitry Safonov dsafonov at virtuozzo.com
Wed Feb 17 02:46:51 PST 2016


One may specify other parameters, but not 'f'.
Piegen should output usage() instead of trying to open "file.o"
as -f is explicit.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/pie/piegen/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/pie/piegen/main.c b/criu/pie/piegen/main.c
index d3ad823..deadf58 100644
--- a/criu/pie/piegen/main.c
+++ b/criu/pie/piegen/main.c
@@ -18,7 +18,7 @@
 #include "piegen.h"
 
 piegen_opt_t opts = {
-	.input_filename		= "file.o",
+	.input_filename		= NULL,
 	.stream_name		= "stream",
 	.prefix_name		= "__",
 	.var_name		= "elf_relocs",
@@ -116,6 +116,9 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (!opts.input_filename)
+		goto usage;
+
 	fd = open(opts.input_filename, O_RDONLY);
 	if (fd < 0) {
 		pr_perror("Can't open file %s", opts.input_filename);
-- 
2.7.1



More information about the CRIU mailing list