coredump: fix the check on the number of passed args in backtrace mode
authorFranck Bui <fbui@suse.com>
Fri, 21 Jun 2019 14:18:39 +0000 (16:18 +0200)
committerFranck Bui <fbui@suse.com>
Thu, 27 Jun 2019 17:01:32 +0000 (19:01 +0200)
In backtrace mode, '--backtrace' option should also be counted.

src/coredump/coredump.c

index add43e7..51e8a5f 100644 (file)
@@ -1254,10 +1254,10 @@ static int process_backtrace(int argc, char *argv[]) {
 
         log_debug("Processing backtrace on stdin...");
 
-        if (argc < CONTEXT_COMM + 1)
+        if (argc < CONTEXT_COMM + 2)
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                        "Not enough arguments passed (%i, expected %i).",
-                                       argc - 1, CONTEXT_COMM + 1 - 1);
+                                       argc - 1, CONTEXT_COMM + 2 - 1);
 
         context[CONTEXT_PID]       = argv[2 + CONTEXT_PID];
         context[CONTEXT_UID]       = argv[2 + CONTEXT_UID];