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

Quentin Rameau <quinq@fifth.space>

From: Quentin Rameau <quinq@fifth.space>
To: pgsql-hackers@lists.postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2019-08-25T19:21:36Z
Lists: pgsql-hackers

Attachments

> 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.
> 
> Patch attached.

Actually OpenBSD seems to set optopt to '?' by default, so the updated
attached patch ensure we start with an empty optopt.

Commits

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