pgsql: pg_waldump: Fix invalid option handling

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_waldump: Fix invalid option handling
Date: 2019-06-06 08:28:36
Message-ID: E1hYnlE-0003vE-H1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_waldump: Fix invalid option handling

Previously, running pg_waldump with an invalid option (pg_waldump
--foo) would print the help output and exit successfully. This was
because it tried to process the option letter '?' as a normal option,
but that letter is used by getopt() to report an invalid option.

To fix, process help and version options separately, like we do
everywhere else. Also add a basic test suite for pg_waldump and run
the basic option handling tests, which would have caught this.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f65eced25118aab29804debc4e0b9a67f4d043ad

Modified Files
--------------
src/bin/pg_waldump/.gitignore | 3 +++
src/bin/pg_waldump/Makefile | 7 +++++++
src/bin/pg_waldump/pg_waldump.c | 25 ++++++++++++++++---------
src/bin/pg_waldump/t/001_basic.pl | 8 ++++++++
4 files changed, 34 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2019-06-06 09:08:25 Re: PGCOLOR? (Re: pgsql: Unified logging system for command-line programs)
Previous Message Heikki Linnakangas 2019-06-06 07:07:11 pgsql: Fix confusion on different kinds of slots in IndexOnlyScans.