[CRIU] [PATCH 3/8] compel hgen: option -o is required

Kir Kolyshkin kir at openvz.org
Mon Dec 5 15:37:06 PST 2016


Without this check, if -o is not given, compel will fail with
the following error:

	Can't open (null)

It's non-trivial to figure out that it means -o is required.

While at it, initialize the corresponding field.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 compel/src/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compel/src/main.c b/compel/src/main.c
index 2a2ba3b..8a2df00 100644
--- a/compel/src/main.c
+++ b/compel/src/main.c
@@ -29,6 +29,7 @@
 
 piegen_opt_t opts = {
 	.input_filename		= NULL,
+	.output_filename	= NULL,
 	.uapi_dir		= "piegen/uapi",
 	.stream_name		= "stream",
 	.prefix_name		= "__",
@@ -225,6 +226,9 @@ int main(int argc, char *argv[])
 		if (!opts.input_filename) {
 			return usage(1);
 		}
+		if (!opts.output_filename) {
+			return usage(1);
+		}
 		compel_log_init(&cli_log, log_level);
 		return piegen();
 	}
-- 
2.7.4



More information about the CRIU mailing list