tree-wide: reset optind to 0 when GNU extensions in optstring are used
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 Mar 2023 01:05:33 +0000 (10:05 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Mar 2023 01:34:41 +0000 (10:34 +0900)
commitef9c12b157a50d63e8a8eb710c013d16c2cea319
tree62406cd13da67e6aadd80b2fad3bf2b5d31aa313
parentdd2d3e975e80f5ae3b64bd9c2b63d866415c764e
tree-wide: reset optind to 0 when GNU extensions in optstring are used

Otherwise, if getopt() and friends are used before parse_argv(), then
the GNU extensions may be ignored.

This should not change any behavior at least now, as we usually use
getopt_long() only once per invocation. But in the next commit,
getopt_long() will be used for other arrays, hence this change will
become necessary.
12 files changed:
src/activate/activate.c
src/ask-password/ask-password.c
src/cgls/cgls.c
src/journal/cat.c
src/login/inhibit.c
src/machine/machinectl.c
src/nspawn/nspawn.c
src/run/run.c
src/shutdown/shutdown.c
src/udev/udevadm-lock.c
src/udev/udevadm.c
src/userdb/userdbctl.c