Skip to content

Commit 562e0d5

Browse files
committed
ping: allow -i and -W option arguments contain garbage input
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: #236 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
1 parent cb799d9 commit 562e0d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ping/ping.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ static double ping_strtod(const char *str, const char *err_msg)
184184
#ifdef USE_IDN
185185
setlocale(LC_ALL, "");
186186
#endif
187-
if (errno || str == end || (end && *end))
188-
goto err;
187+
if (errno || str == end || (end && *end)) {
188+
error(0, 0, _("option argument contains garbage: %s"), end);
189+
error(0, 0, _("this will become fatal error in future"));
190+
}
189191
switch (fpclassify(num)) {
190192
case FP_NORMAL:
191193
case FP_ZERO:

0 commit comments

Comments
 (0)