From 52153c502ad12c723231f5c7cb80d50a5d0691cd Mon Sep 17 00:00:00 2001 From: aravind-kumar Date: Wed, 15 Mar 2017 22:46:42 +0530 Subject: [PATCH] check_positive_number --- include/crm_internal.h | 1 + lib/common/utils.c | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/crm_internal.h b/include/crm_internal.h index 96a68bd..31d4efe 100644 --- a/include/crm_internal.h +++ b/include/crm_internal.h @@ -126,6 +126,7 @@ gboolean check_time(const char *value); gboolean check_timer(const char *value); gboolean check_boolean(const char *value); gboolean check_number(const char *value); +gboolean check_positive_number(const char *value); gboolean check_quorum(const char *value); gboolean check_script(const char *value); gboolean check_utilization(const char *value); diff --git a/lib/common/utils.c b/lib/common/utils.c index dbf84c0..32c004d 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -162,6 +162,15 @@ check_number(const char *value) } gboolean +check_positive_number(const char* value) +{ + if (check_number(value) && (value[0] != '-') && !(safe_str_eq(value,"0"))) { + return TRUE; + } + return FALSE; +} + +gboolean check_quorum(const char *value) { if (safe_str_eq(value, "stop")) { -- 1.8.3.1