From b025ef1dbcd4170de34e276a76e35c87ccf423e1 Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Thu, 22 Jan 2015 18:57:39 +0300 Subject: [PATCH] criu: return an error if arguments contains more than one command For example: $ criu show stats-dump Error (crtools.c:468): Unable to handle more than one command $ ./criu show -f stats-dump dump: { freezing_time: 626 frozen_time: 24762 memdump_time: 2696 memwrite_time: 1007 pages_scanned: 1108 pages_skipped_parent: 0 pages_written: 28 irmap_resolve: 0 } Reported-by: Thouraya TH Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- crtools.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crtools.c b/crtools.c index e235faa15..552626575 100644 --- a/crtools.c +++ b/crtools.c @@ -463,6 +463,9 @@ int main(int argc, char *argv[], char *envp[]) opts.exec_cmd = xmalloc((argc - optind) * sizeof(char *)); memcpy(opts.exec_cmd, &argv[optind + 1], (argc - optind - 1) * sizeof(char *)); opts.exec_cmd[argc - optind - 1] = NULL; + } else if (optind + 1 != argc) { + pr_err("Unable to handle more than one command\n"); + goto usage; } /* We must not open imgs dir, if service is called */