[Asterisk-code-review] core: fix getopt(3) usage (asterisk[14])

Guido Falsi asteriskteam at digium.com
Mon Mar 26 07:45:33 CDT 2018


Guido Falsi has uploaded this change for review. ( https://gerrit.asterisk.org/8670


Change subject: core: fix getopt(3) usage
......................................................................

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
---
M main/asterisk.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/70/8670/1

diff --git a/main/asterisk.c b/main/asterisk.c
index 8931496..ace6c25 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -4110,7 +4110,7 @@
 	 *
 	 * \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

-- 
To view, visit https://gerrit.asterisk.org/8670
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61
Gerrit-Change-Number: 8670
Gerrit-PatchSet: 1
Gerrit-Owner: Guido Falsi <madpilot at freebsd.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180326/02e08bd2/attachment.html>


More information about the asterisk-code-review mailing list