agora inbox for pgsql-hackers@postgresql.orghelp / color / mirror / Atom feed
[PATCH v1] Fix optind handling inconsistency in getopt_long() for missing argument 1+ messages / 1 participants [nested] [flat]
* [PATCH v1] Fix optind handling inconsistency in getopt_long() for missing argument @ 2026-07-21 09:49 Japin Li <japinli@hotmail.com> 0 siblings, 0 replies; 1+ messages in thread From: Japin Li @ 2026-07-21 09:49 UTC (permalink / raw) Move optind++ and place = EMSG before the BADARG return in the long option path to match short option behavior and ensure consistent state. --- src/port/getopt_long.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c index 20953db9db1..a488a647889 100644 --- a/src/port/getopt_long.c +++ b/src/port/getopt_long.c @@ -145,6 +145,9 @@ retry: } else { + place = EMSG; + optind++; + if (optstring[0] == ':') return BADARG; @@ -153,9 +156,6 @@ retry: "%s: option requires an argument -- %s\n", argv[0], place); - place = EMSG; - optind++; - if (has_arg == required_argument) return BADCH; optarg = NULL; -- 2.53.0 --=-=-=-- ^ permalink raw reply [nested|flat] 1+ messages in thread
only message in thread Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-07-21 09:49 [PATCH v1] Fix optind handling inconsistency in getopt_long() for missing argument Japin Li <japinli@hotmail.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox