diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-02 23:37:12 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-02 23:37:12 +0200 |
commit | 46c5327e348540ab04dc37d42f6d1c5408179fa6 (patch) | |
tree | 06daa9142183c0f6c6624bebcffd7d11de1ab976 /plugins/utils.c | |
parent | d2f2da175eda5a06291a974d971968a1241d7935 (diff) | |
download | monitoring-plugins-46c5327e348540ab04dc37d42f6d1c5408179fa6.tar.gz |
Revert to poor man's logic
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/utils.c b/plugins/utils.c index 011f715d..f7f8952f 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -246,19 +246,19 @@ is_intnonneg (char *number) | |||
246 | * On success the number will be written to the _target_ address, if _target_ is not set | 246 | * On success the number will be written to the _target_ address, if _target_ is not set |
247 | * to NULL. | 247 | * to NULL. |
248 | */ | 248 | */ |
249 | bool is_int64(char *number, int64_t *target) { | 249 | int is_int64(char *number, int64_t *target) { |
250 | errno = 0; | 250 | errno = 0; |
251 | uint64_t tmp = strtoll(number, NULL, 10); | 251 | uint64_t tmp = strtoll(number, NULL, 10); |
252 | if (errno != 0) { | 252 | if (errno != 0) { |
253 | return false; | 253 | return 0; |
254 | } | 254 | } |
255 | if (tmp < INT64_MIN || tmp > INT64_MAX) { | 255 | if (tmp < INT64_MIN || tmp > INT64_MAX) { |
256 | return false; | 256 | return 0; |
257 | } | 257 | } |
258 | if (target != NULL) { | 258 | if (target != NULL) { |
259 | *target = tmp; | 259 | *target = tmp; |
260 | } | 260 | } |
261 | return true; | 261 | return 1; |
262 | } | 262 | } |
263 | 263 | ||
264 | /* | 264 | /* |
@@ -266,19 +266,19 @@ bool is_int64(char *number, int64_t *target) { | |||
266 | * On success the number will be written to the _target_ address, if _target_ is not set | 266 | * On success the number will be written to the _target_ address, if _target_ is not set |
267 | * to NULL. | 267 | * to NULL. |
268 | */ | 268 | */ |
269 | bool is_uint64(char *number, uint64_t *target) { | 269 | int is_uint64(char *number, uint64_t *target) { |
270 | errno = 0; | 270 | errno = 0; |
271 | uint64_t tmp = strtoll(number, NULL, 10); | 271 | uint64_t tmp = strtoll(number, NULL, 10); |
272 | if (errno != 0) { | 272 | if (errno != 0) { |
273 | return false; | 273 | return 0; |
274 | } | 274 | } |
275 | if (tmp < 0 || tmp > UINT64_MAX) { | 275 | if (tmp < 0 || tmp > UINT64_MAX) { |
276 | return false; | 276 | return 0; |
277 | } | 277 | } |
278 | if (target != NULL) { | 278 | if (target != NULL) { |
279 | *target = tmp; | 279 | *target = tmp; |
280 | } | 280 | } |
281 | return true; | 281 | return 1; |
282 | } | 282 | } |
283 | 283 | ||
284 | int | 284 | int |