summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2013-01-17 15:35:07 +0530
committerAnand Avati <avati@redhat.com>2013-02-18 11:47:09 -0800
commit6ff25bc98193fd39e25acfce8e3b2f3b3d80a9c8 (patch)
treed9a939128cb75f63694a25f4448b37c241562038 /libglusterfs
parentef830366a38d9420ad9a5065226b1911125ca8aa (diff)
libglusterfs: make gf_string2percent_or_bytesize to convert float numbers.
Change-Id: I0ac6588297bdb8b085c3c9b01848a098f7fd4293 BUG: 912206 Signed-off-by: Varun Shastry <vshastry@redhat.com> Reviewed-on: http://review.gluster.org/4533 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 19afeee3d1f..8c50b157acf 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;
}