From 41aaa4184fef8b293435f7f8054638d4d0979f7c Mon Sep 17 00:00:00 2001 From: Naoki Ikeguchi Date: Sun, 23 Jan 2022 19:29:19 +0900 Subject: [PATCH] Avoid double setting values in statfs --- src/s3fs.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 572a316..4867515 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -2332,16 +2332,18 @@ static int s3fs_statfs(const char* _path, struct statvfs* stbuf) { // WTF8_ENCODE(path) stbuf->f_bsize = 16 * 1024 * 1024; - stbuf->f_blocks = static_cast(~0) / stbuf->f_bsize; - stbuf->f_bfree = stbuf->f_blocks; - stbuf->f_bavail = stbuf->f_blocks; stbuf->f_namemax = NAME_MAX; #ifdef __MSYS__ // WinFsp resolves the free space from f_bfree * f_frsize, and the total space from f_blocks * f_frsize (in bytes). stbuf->f_frsize = stbuf->f_bsize; stbuf->f_blocks = INT32_MAX; stbuf->f_bfree = INT32_MAX; +#else + stbuf->f_blocks = static_cast(~0) / stbuf->f_bsize; + stbuf->f_bfree = stbuf->f_blocks; #endif + stbuf->f_bavail = stbuf->f_blocks; + return 0; }