getopt: fix optional argument processing
commitacccc93e084641861ca553317edb7da7791833b5
authorFelix Fietkau <nbd@openwrt.org>
Tue, 21 Oct 2014 20:24:50 +0000 (21 22:24 +0200)
committerRich Felker <dalias@aerifal.cx>
Sun, 16 Nov 2014 04:44:53 +0000 (15 23:44 -0500)
tree3e18e6ed37e3710900624fd09657fbf7fb2c5c9f
parent941644e98c3d05761b4639a8ae5afacd8586d1b9
getopt: fix optional argument processing

Processing an option character with optional argument fails if the
option is last on the command line. This happens because the
if (optind >= argc) check runs first before testing for optional
argument.
src/misc/getopt.c