From 6ff25bc98193fd39e25acfce8e3b2f3b3d80a9c8 Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Thu, 17 Jan 2013 15:35:07 +0530 Subject: libglusterfs: make gf_string2percent_or_bytesize to convert float numbers. Change-Id: I0ac6588297bdb8b085c3c9b01848a098f7fd4293 BUG: 912206 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/4533 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/common-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 19afeee3d..8c50b157a 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1369,7 +1369,7 @@ gf_string2percent_or_bytesize (const char *str, uint64_t *n, gf_boolean_t *is_percent) { - uint64_t value = 0ULL; + double value = 0ULL; char *tail = NULL; int old_errno = 0; const char *s = NULL; @@ -1391,7 +1391,7 @@ gf_string2percent_or_bytesize (const char *str, old_errno = errno; errno = 0; - value = strtoull (str, &tail, 10); + value = strtod (str, &tail); if (str == tail) errno = EINVAL; @@ -1418,7 +1418,7 @@ gf_string2percent_or_bytesize (const char *str, return -1; } - *n = value; + *n = (uint64_t) value; return 0; } -- cgit