Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
consistent calculation of ram_* on openbsd
[slstatus.git]
/
components
/
disk.c
diff --git
a/components/disk.c
b/components/disk.c
index
2ce260b
..
8112981
100644
(file)
--- a/
components/disk.c
+++ b/
components/disk.c
@@
-23,7
+23,6
@@
disk_free(const char *mnt)
const char *
disk_perc(const char *mnt)
{
const char *
disk_perc(const char *mnt)
{
- int perc;
struct statvfs fs;
if (statvfs(mnt, &fs) < 0) {
struct statvfs fs;
if (statvfs(mnt, &fs) < 0) {
@@
-31,9
+30,8
@@
disk_perc(const char *mnt)
return NULL;
}
return NULL;
}
- perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
-
- return bprintf("%d", perc);
+ return bprintf("%d", (int)(100 *
+ (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks))));
}
const char *
}
const char *