From 86491818074044ff4a3b992c4e7ce7b63eada412 Mon Sep 17 00:00:00 2001 From: Dongju Chae Date: Tue, 16 Jul 2019 20:32:33 +0900 Subject: [PATCH] [Main] Fix bugs in argument parsing This commit fixs the argument parsing bug. It didn't check whether `argc` is larger than 1. Signed-off-by: Dongju Chae --- core/npu-engine/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/npu-engine/src/main.c b/core/npu-engine/src/main.c index cdaa9bc..6491e71 100644 --- a/core/npu-engine/src/main.c +++ b/core/npu-engine/src/main.c @@ -44,7 +44,7 @@ int main (int argc, char **argv) { int counter = 1; char *confpath = NULL; - do { + while (counter < argc) { if (!strcmp(argv[counter], "-h")) { printf(helpmsg, argv[0]); return 0; @@ -64,7 +64,7 @@ int main (int argc, char **argv) { } counter++; - } while (counter >= argc); + } if (daemon_mode) { process_id = fork(); -- 2.7.4