Skip to content

Commit

Permalink
ping: allow -i and -W option arguments contain garbage input
Browse files Browse the repository at this point in the history
Earlier 'ping -W 1s ...' worked without complaints, but the user interface
regression broke that.  Notice that none-numeric value was simply ignored,
so '-W 1s' and and '-W 1h' meant the same although they looked different.
That was misleading, but because values still managed to work for next
couple releases accepting number with garbage at end is re-introduced.

Regression-since; 918e824
Addresses: iputils#236
Signed-off-by: Sami Kerola <[email protected]>
  • Loading branch information
kerolasa committed Nov 29, 2019
1 parent cb799d9 commit 562e0d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ping/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ static double ping_strtod(const char *str, const char *err_msg)
#ifdef USE_IDN
setlocale(LC_ALL, "");
#endif
if (errno || str == end || (end && *end))
goto err;
if (errno || str == end || (end && *end)) {
error(0, 0, _("option argument contains garbage: %s"), end);
error(0, 0, _("this will become fatal error in future"));
}
switch (fpclassify(num)) {
case FP_NORMAL:
case FP_ZERO:
Expand Down

0 comments on commit 562e0d5

Please sign in to comment.