* [PATCH iputils] ping: fix -i number parsing in locales
@ 2015-04-25 0:45 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2015-04-25 0:45 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger
Always use #.# format for the -i flag even when the current locale uses
a different separator. Locale de_DE which uses #,# normally.
Simple testcase:
$ make USE_IDN=1
$ LANG=de_DE.UTF8 ./ping -i 0.5 localhost
Reported-by: Sergey Fionov <fionov@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
ping_common.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ping_common.c b/ping_common.c
index 62f53a6..0a37e09 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -269,9 +269,17 @@ void common_options(int ch)
double dbl;
char *ep;
+#ifdef USE_IDN
+ setlocale(LC_ALL, "C");
+#endif
+
errno = 0;
dbl = strtod(optarg, &ep);
+#ifdef USE_IDN
+ setlocale(LC_ALL, "");
+#endif
+
if (errno || *ep != '\0' ||
!finite(dbl) || dbl < 0.0 || dbl >= (double)INT_MAX / 1000 - 1.0) {
fprintf(stderr, "ping: bad timing interval\n");
--
2.3.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-25 0:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-25 0:45 [PATCH iputils] ping: fix -i number parsing in locales Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).