1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 21:49:07 +00:00

Minor fix for fs_used_perc, fs_free and fs_free_perc

This commit is contained in:
Or Cohen 2009-04-09 15:28:45 -06:00 committed by Brenden Matthews
parent ea34b2c5e5
commit b6e691e8ac
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2009-04-09
* Fix broken xmms2 compilation (thanks fusetak)
* Minor fix for fs_used_perc, fs_free and fs_free_perc (thanks
lightpriest)
2009-03-28
* Applied FreeBSD patches (thanks Nikos)

View File

@ -3719,15 +3719,19 @@ static void generate_text_internal(char *p, int p_max_size,
}
OBJ(fs_free) {
if (obj->data.fs != NULL) {
human_readable(obj->data.fs->avail, p, 255);
human_readable( (obj->data.fs->free ? obj->data.fs->free :
obj->data.fs->avail), p, 255);
}
}
OBJ(fs_free_perc) {
if (obj->data.fs != NULL) {
int val = 0;
if (obj->data.fs->size)
val = obj->data.fs->avail * 100 / obj->data.fs->size;
if (obj->data.fs->size) {
val = (obj->data.fs->free ? obj->data.fs->free :
obj->data.fs->avail) * 100 /
obj->data.fs->size;
}
percent_print(p, p_max_size, val);
}
@ -3762,8 +3766,11 @@ static void generate_text_internal(char *p, int p_max_size,
if (obj->data.fs != NULL) {
int val = 0;
if (obj->data.fs->size)
val = obj->data.fs->avail * 100 / obj->data.fs->size;
if (obj->data.fs->size) {
val = (obj->data.fs->free ? obj->data.fs->free :
obj->data.fs->avail) * 100 /
obj->data.fs->size;
}
percent_print(p, p_max_size, 100 - val);
}