summaryrefslogtreecommitdiffstats
path: root/plugins/check_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r--plugins/check_load.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 9de8ff7..5503204 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -77,6 +77,7 @@ static void
77get_threshold(char *arg, double *th) 77get_threshold(char *arg, double *th)
78{ 78{
79 size_t i, n; 79 size_t i, n;
80 int valid = 0;
80 char *str = arg, *p; 81 char *str = arg, *p;
81 82
82 n = strlen(arg); 83 n = strlen(arg);
@@ -84,12 +85,13 @@ get_threshold(char *arg, double *th)
84 th[i] = strtod(str, &p); 85 th[i] = strtod(str, &p);
85 if(p == str) break; 86 if(p == str) break;
86 87
88 valid = 1;
87 str = p + 1; 89 str = p + 1;
88 if(n <= (size_t)(str - arg)) break; 90 if(n <= (size_t)(str - arg)) break;
89 } 91 }
90 92
91 /* empty argument or non-floatish, so warn about it and die */ 93 /* empty argument or non-floatish, so warn about it and die */
92 if(!i) usage (_("Warning threshold must be float or float triplet!\n")); 94 if(!i && !valid) usage (_("Warning threshold must be float or float triplet!\n"));
93 95
94 if(i != 2) { 96 if(i != 2) {
95 /* one or more numbers were given, so fill array with last 97 /* one or more numbers were given, so fill array with last