From d6b6c32ac7f0a6b3d77009aec8bdd0cd289bd0ff Mon Sep 17 00:00:00 2001 From: vmallika Date: Mon, 2 Mar 2015 13:10:24 +0530 Subject: function gf_string2bytesize_range should handle 'xB' byte values Change-Id: I208289aae2423e4bb015cf33bafd2a961e1c3fc6 BUG: 1197593 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/9779 Reviewed-by: Atin Mukherjee Tested-by: Gluster Build System Reviewed-by: Sachin Pandit Reviewed-by: Vijay Bellur --- libglusterfs/src/common-utils.c | 2 +- libglusterfs/src/common-utils.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 1adfdaa1673..f9eea5e5fd0 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1493,7 +1493,7 @@ gf_string2bytesize_range (const char *str, uint64_t *n, uint64_t max) value *= GF_UNIT_TB; else if (strcasecmp (tail, GF_UNIT_PB_STRING) == 0) value *= GF_UNIT_PB; - else + else if (strcasecmp (tail, GF_UNIT_B_STRING) != 0) return -1; } diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index ecf25aa9177..d60ba89db55 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -60,6 +60,7 @@ void trap (void); #define GF_UNIT_TB 1099511627776ULL #define GF_UNIT_PB 1125899906842624ULL +#define GF_UNIT_B_STRING "B" #define GF_UNIT_KB_STRING "KB" #define GF_UNIT_MB_STRING "MB" #define GF_UNIT_GB_STRING "GB" -- cgit