| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix error handling in port's getopt_long() for missing argument |
| Date: | 2026-07-31 03:45:17 |
| Message-ID: | E1wpeBR-000000012WB-0HIP@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix error handling in port's getopt_long() for missing argument
In the long option error path, the code previously returned BADARG
immediately when optstring[0] == ':' for a missing required argument,
without advancing "optind" or resetting "place". This error handling
was inconsistent with the short option path, where both updates are
performed before returning BADARG (and inconsistent with libc,
additionally..).
This affects platforms where our port version of getopt_long() is used,
a concept that should be limited to WIN32 these days. An argument could
be made in favor of a backpatch, but this could lead to a slight
different error handling, for a report that would only show up when
using incorrect option combinations.
Author: Japin Li <japinli(at)hotmail(dot)com>
Discussion: https://postgr.es/m/SY7PR01MB10921AF81F18A8BCFA06388BEB6C22@SY7PR01MB10921.ausprd01.prod.outlook.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/745becce3321267a4530af286433d1dc6f043360
Modified Files
--------------
src/port/getopt_long.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-07-31 04:35:40 | pgsql: Improve wording of sequence origin warning in logical replicatio |
| Previous Message | David Rowley | 2026-07-31 03:39:35 | pgsql: Fix issue with RANGE's DEFAULT partition pruning |