Commit 48d1daee authored by Steven Murray's avatar Steven Murray
Browse files

Fixed segmentation fault with long options

parent db4d1511
......@@ -31,10 +31,10 @@ namespace catalogue {
CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *const *const argv):
help(false) {
static struct option longopts[] = {
{"comment" , 0, NULL, 'c'},
{"help" , 0, NULL, 'h'},
{"hostname" , 0, NULL, 'n'},
{NULL , 0, NULL, 0}
{"comment" , required_argument, NULL, 'c'},
{"help" , no_argument, NULL, 'h'},
{"hostname" , required_argument, NULL, 'n'},
{NULL , 0, NULL, 0}
};
// Prevent getopt() from printing an error message if it does not recognize
......
......@@ -31,10 +31,10 @@ namespace catalogue {
CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *const *const argv):
help(false) {
static struct option longopts[] = {
{"comment" , 0, NULL, 'c'},
{"help" , 0, NULL, 'h'},
{"username" , 0, NULL, 'u'},
{NULL , 0, NULL, 0}
{"comment" , required_argument, NULL, 'c'},
{"help" , no_argument, NULL, 'h'},
{"username" , required_argument, NULL, 'u'},
{NULL , 0, NULL, 0}
};
// Prevent getopt() from printing an error message if it does not recognize
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment