From: Guido Falsi Date: Mon, 26 Mar 2018 12:42:52 +0000 (+0200) Subject: core: fix getopt(3) usage X-Git-Tag: 15.4.0-rc1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35ebe3376d94d8f14ad4ef8cf8ab786da5416778;p=thirdparty%2Fasterisk.git core: fix getopt(3) usage Setting optind = 0 is forced to 1 in glibc implementation, but causes option parsing to be flawed in other implementations, for example on FreeBSD. ASTERISK-27773 #close Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61 --- diff --git a/main/asterisk.c b/main/asterisk.c index 0442614a40..568feb0b6b 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -3995,7 +3995,7 @@ int main(int argc, char *argv[]) * * \todo Document these options */ - optind = 0; + optind = 1; while ((c = getopt(argc, argv, getopt_settings)) != -1) { /*!\note Please keep the ordering here to alphabetical, capital letters * first. This will make it easier in the future to select unused