diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-12-11 01:07:02 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-12-11 01:07:02 -0500 |
commit | b4ef1830b7863bfba1da4bdad56a20ef398672a8 (patch) | |
tree | 7aefe53ac7072a39e9c08b39568daba24c7c99d2 | |
parent | d4f7d9c46f0e8f19d70871efb66b0f482935642d (diff) | |
download | musl-b4ef1830b7863bfba1da4bdad56a20ef398672a8.tar.gz musl-b4ef1830b7863bfba1da4bdad56a20ef398672a8.tar.bz2 musl-b4ef1830b7863bfba1da4bdad56a20ef398672a8.tar.xz musl-b4ef1830b7863bfba1da4bdad56a20ef398672a8.zip |
accept null longopts pointer in getopt_long
this is an undocumented feature of GNU getopt_long that the BSD
version also mimics, and is reportedly needed by some programs.
-rw-r--r-- | src/misc/getopt_long.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c index 469ee920..c3cf7f93 100644 --- a/src/misc/getopt_long.c +++ b/src/misc/getopt_long.c @@ -52,7 +52,7 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly) { - if (argv[optind][0] == '-' && + if (longopts && argv[optind][0] == '-' && ((longonly && argv[optind][1]) || (argv[optind][1] == '-' && argv[optind][2]))) { |