Prevent segfault when unknown option is given.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 29 Nov 2013 00:59:26 +0000 (01:59 +0100)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 29 Nov 2013 01:00:29 +0000 (02:00 +0100)
idm.cpp
scan.cpp

diff --git a/idm.cpp b/idm.cpp
index 9fa4495..0c425a4 100644 (file)
--- a/idm.cpp
+++ b/idm.cpp
@@ -11,6 +11,7 @@
 struct option longopts[] = {
        { "config", required_argument, NULL, 'c' },
        { "help", no_argument, NULL, 'h' },
+       { NULL, no_argument, NULL, 0 },
 };
 
 const char *optstring = "hc:u:";
index 2ef9076..a1ca7ee 100644 (file)
--- a/scan.cpp
+++ b/scan.cpp
@@ -21,6 +21,7 @@
 struct option longopts[] = {
        { "config", required_argument, NULL, 'c' },
        { "help", no_argument, NULL, 'h' },
+       { NULL, no_argument, NULL, 0},
 };
 
 const char *optstring = "c:h";