Re: [HACKERS] Small patch for pg_basebackup argument parsing - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] Small patch for pg_basebackup argument parsing
Date
Msg-id CAB7nPqQOGLhGFW+1D=_WHLhaJLv+WafhHN-2n-vvo_K=Ds9-OA@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Small patch for pg_basebackup argument parsing  (Pierre Ducroquet <p.psql@pinaraf.info>)
Responses Re: [HACKERS] Small patch for pg_basebackup argument parsing  (Pierre Ducroquet <p.psql@pinaraf.info>)
List pgsql-hackers
On Fri, Apr 14, 2017 at 6:32 AM, Pierre Ducroquet <p.psql@pinaraf.info> wrote:
> Yesterday while doing a few pg_basebackup, I realized that the integer
> parameters were not properly checked against invalid input.
> It is not a critical issue, but this could be misleading for an user who
> writes -z max or -s 0.5…
> I've attached the patch to this mail. Should I add it to the next commit fest
> or is it not needed for such small patches ?

A call to atoi is actually equivalent to strtol with the rounding:
(int)strtol(str, (char **)NULL, 10);
So I don't think this is worth caring.

By doing a git grep "atoi(optarg)" you'll see far more places that
handle integer options this way as well...
--
Michael



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] Undefined psql variables
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] logical replication and PANIC during shutdowncheckpoint in publisher