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

Guido Falsi asteriskteam at digium.com
Mon Mar 26 07:50:54 CDT 2018


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


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/72/8672/1

diff --git a/main/asterisk.c b/main/asterisk.c
index 36b1b54..2e80ffa 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3963,7 +3963,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/8672
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61
Gerrit-Change-Number: 8672
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/1c4bada3/attachment.html>


More information about the asterisk-code-review mailing list