From: jsing Date: Sun, 28 Dec 2014 16:33:34 +0000 (+0000) Subject: Allow a default option to be specified by having a NULL name, but a valid X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=73bf9b7891a9751969f2c4765de06bb7a1adde16;p=openbsd Allow a default option to be specified by having a NULL name, but a valid option type. In this case process the option as per normal. --- diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index 1155278b791..1a52e7681b8 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.20 2014/12/28 16:22:37 jsing Exp $ */ +/* $OpenBSD: apps.c,v 1.21 2014/12/28 16:33:34 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -2288,11 +2288,11 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed, /* See if there is a matching option... */ for (j = 0; opts[j].name != NULL; j++) { - opt = &opts[j]; - if (strcmp(p, opt->name) == 0) + if (strcmp(p, opts[j].name) == 0) break; } - if (opts[j].name == NULL) + opt = &opts[j]; + if (opts->name == NULL && opts->type == 0) goto unknown; if (opt->type == OPTION_ARG ||