summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorAaron Marcher <me@drkhsh.at>2018-05-07 11:44:15 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-07 11:44:15 +0200
commit4fc4983502243b916acac7d61c09529ee744d759 (patch)
treed77c91e4f83d545235a190c36513fd7e37c04733 /components
parentb3330d849def11137a6905675e123b7ba9cce438 (diff)
disk_perc: Simplify
Diffstat (limited to 'components')
-rw-r--r--components/disk.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/components/disk.c b/components/disk.c
index 2ce260b..a225421 100644
--- a/components/disk.c
+++ b/components/disk.c
@@ -23,7 +23,6 @@ disk_free(const char *mnt)
const char *
disk_perc(const char *mnt)
{
- int perc;
struct statvfs fs;
if (statvfs(mnt, &fs) < 0) {
@@ -31,9 +30,8 @@ disk_perc(const char *mnt)
return NULL;
}
- perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
-
- return bprintf("%d", perc);
+ return bprintf("%d", 100 *
+ (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks)));
}
const char *