Ensure humanize_size works for negative values

Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Jakob Gruber 2011-06-15 11:04:09 +02:00 committed by Dan McGee
parent 5b33f48389
commit e92083798c
1 changed files with 1 additions and 1 deletions

View File

@ -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;