commit: 955e8d080f4a2b518fac93bd437fae1882788138
parent f0ce444240d26044f870cb9a26f2d3c8cf38ce11
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 18 Apr 2024 18:29:12 +0200
cmd/df: Use off_t for file sizes, blksize_t for blocks
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cmd/df.c b/cmd/df.c
@@ -28,7 +28,7 @@ static const char *net_fs_list[] = {
};
// clang-format on
-size_t forced_bsize = 0;
+blksize_t forced_bsize = 0;
// Replaces control characters and whitespaces with '?' in-place (no allocation)
static void
@@ -230,7 +230,7 @@ main(int argc, char *argv[])
if(argc > 0)
{
bool found = false;
- for(size_t i = 0; i < argc; i++)
+ for(int i = 0; i < argc; i++)
if(arg_devs[i] == file_stats.st_dev)
{
found = true;
@@ -296,10 +296,10 @@ main(int argc, char *argv[])
static_escape(mntent->mnt_fsname);
static_escape(mntent->mnt_dir);
- size_t percent = 0;
- size_t total = stats.f_frsize * (stats.f_blocks != 0 ? stats.f_blocks : 1);
- size_t free = stats.f_bfree * (stats.f_bsize != 0 ? stats.f_bsize : 1);
- size_t used = total - free;
+ off_t percent = 0;
+ off_t total = stats.f_frsize * (stats.f_blocks != 0 ? stats.f_blocks : 1);
+ off_t free = stats.f_bfree * (stats.f_bsize != 0 ? stats.f_bsize : 1);
+ off_t used = total - free;
if(used + free)
{