Re: [PATCH] Fix missing argument handling in psql getopt

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Quentin Rameau <quinq@fifth.space>
Cc: pgsql-hackers@postgresql.org
Date: 2019-08-25T19:28:12Z
Lists: pgsql-hackers
Quentin Rameau <quinq@fifth.space> writes:
> Another better way, I think, to fix this is to check for optopt
> instead, which would be set to the option which caused the error, which
> if empty means there isn't an error.

Meh.  We don't use optopt at all today, and I don't especially want
to start doing so.  A patch that's trying to remove a platform
dependency (which is what this is, pedantic arguments that musl can
read POSIX better than anyone else notwithstanding) should not do
so by introducing hazards of new platform dependencies.

I've pushed your original patch (with some comment-tweaking).
It seems unlikely to break anything.

			regards, tom lane



Commits

  1. Avoid platform-specific null pointer dereference in psql.