avoid integer overflow for usleep() arg
This commit is contained in:
parent
5c591b836f
commit
d4a9781d4a
1
NEWS
1
NEWS
@ -4,6 +4,7 @@ top: document H option -- thanks Tony Ernst
|
||||
top: terabytes -- thanks Tony Ernst
|
||||
ps: SCHED_BATCH is B
|
||||
ps: fix s format (signals) output with thread display
|
||||
watch: avoid integer overflow for the time delay
|
||||
|
||||
procps-3.2.5 --> procps-3.2.6
|
||||
|
||||
|
6
watch.c
6
watch.c
@ -141,7 +141,7 @@ main(int argc, char *argv[])
|
||||
int option_differences = 0,
|
||||
option_differences_cumulative = 0,
|
||||
option_help = 0, option_version = 0;
|
||||
float interval = 2;
|
||||
double interval = 2;
|
||||
char *command;
|
||||
int command_length = 0; /* not including final \0 */
|
||||
|
||||
@ -165,11 +165,13 @@ main(int argc, char *argv[])
|
||||
case 'n':
|
||||
{
|
||||
char *str;
|
||||
interval = strtof(optarg, &str);
|
||||
interval = strtod(optarg, &str);
|
||||
if (!*optarg || *str)
|
||||
do_usage();
|
||||
if(interval < 0.1)
|
||||
interval = 0.1;
|
||||
if(interval > ~0u/1000000)
|
||||
interval = ~0u/1000000;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
|
Loading…
Reference in New Issue
Block a user