mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Minor fix for fs_used_perc, fs_free and fs_free_perc
This commit is contained in:
parent
ea34b2c5e5
commit
b6e691e8ac
@ -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)
|
||||
|
||||
|
17
src/conky.c
17
src/conky.c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user