From e92083798cdd98961e0d2befe25af7a8f96c9ab5 Mon Sep 17 00:00:00 2001 From: Jakob Gruber Date: Wed, 15 Jun 2011 11:04:09 +0200 Subject: Ensure humanize_size works for negative values Signed-off-by: Jakob Gruber Signed-off-by: Dan McGee --- src/pacman/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index d142cb75..2a7b3773 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -831,7 +831,7 @@ double humanize_size(off_t bytes, const char target_unit, int long_labels, for(index = 0; index < unitcount - 1; index++) { if(target_unit != '\0' && shortlabels[index][0] == target_unit) { break; - } else if(target_unit == '\0' && val <= 2048.0) { + } else if(target_unit == '\0' && val <= 2048.0 && val >= -2048.0) { break; } val /= 1024.0; -- cgit v1.2.3-70-g09d2