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

Jenkins2 asteriskteam at digium.com
Thu Mar 29 10:52:26 CDT 2018


Jenkins2 has submitted this change and it was merged. ( 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(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit



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: merged
Gerrit-Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61
Gerrit-Change-Number: 8672
Gerrit-PatchSet: 1
Gerrit-Owner: Guido Falsi <madpilot at freebsd.org>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180329/c7a33228/attachment.html>


More information about the asterisk-code-review mailing list