diff --git a/daemon/bin/main.cpp b/daemon/bin/main.cpp index 83a40182c8bfc8a533e32a5072a43fab6b5bb57f..145f8e0f1fbde906bd20ea0f9fcdff96a2cfb8db 100644 --- a/daemon/bin/main.cpp +++ b/daemon/bin/main.cpp @@ -85,7 +85,13 @@ parse_args(int argc, char *argv[], bool& persistent) /* getopt_long stores the option index here. */ int option_index = 0; - switch (getopt_long(argc, argv, "dcphv", long_options, &option_index)) { + auto c = getopt_long(argc, argv, "dcphv", long_options, &option_index); + + // end of the options + if (c == -1) + break; + + switch (c) { case 'd': debugFlag = true; break; @@ -107,7 +113,6 @@ parse_args(int argc, char *argv[], bool& persistent) versionFlag = true; break; - case -1: // end of the options default: break; } diff --git a/daemon/bin/osxmain.cpp b/daemon/bin/osxmain.cpp index e0a24d966c077ada0280390aaa7f05fb2a95f8c3..1a752362388be8b58fc387dfb08c3fd71bf48c9d 100644 --- a/daemon/bin/osxmain.cpp +++ b/daemon/bin/osxmain.cpp @@ -90,7 +90,13 @@ parse_args(int argc, char *argv[], bool& persistent) /* getopt_long stores the option index here. */ int option_index = 0; - switch (getopt_long(argc, argv, "dcphv", long_options, &option_index)) { + auto c = getopt_long(argc, argv, "dcphv", long_options, &option_index); + + // end of the options + if (c == -1) + break; + + switch (c) { case 'd': debugFlag = true; break; @@ -112,7 +118,6 @@ parse_args(int argc, char *argv[], bool& persistent) versionFlag = true; break; - case -1: // end of the options default: break; }