X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Foping.c;h=3ae226c6f5e64d25e31d3ab3d960e0e673a8289f;hb=a336f1ecc9665dc1d2f20fd8dfe6d9a93bb41b25;hp=08423eac3887118443b83e87e347284d54ac405b;hpb=9f4c3107df0c18f18e0deab19b78f59e4e4d2b9c;p=liboping.git diff --git a/src/oping.c b/src/oping.c index 08423ea..3ae226c 100644 --- a/src/oping.c +++ b/src/oping.c @@ -701,20 +701,16 @@ static int read_options (int argc, char **argv) /* {{{ */ break; case 'w': - { - char *endp; - double t = strtod(optarg, &endp); - if(optarg[0] != '\0' && *endp == '\0') { - opt_timeout = t; - } - else{ - fprintf (stderr, "Ignoring invalid timeout: %s\n", - optarg); + char *endp = NULL; + double t = strtod (optarg, &endp); + if ((optarg[0] != 0) && (endp != NULL) && (*endp == 0)) + opt_timeout = t; + else + fprintf (stderr, "Ignoring invalid timeout: %s\n", + optarg); } - break; - } case 'I': { @@ -1682,7 +1678,7 @@ int main (int argc, char **argv) /* {{{ */ } #endif - setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); optind = read_options (argc, argv); #if !_POSIX_SAVED_IDS