ports/sysutils/amazon-ssm-agent/patches/patch-agent_fileutil_fileutil_unix_go

22 lines
1.1 KiB
Text

Index: agent/fileutil/fileutil_unix.go
--- agent/fileutil/fileutil_unix.go.orig
+++ agent/fileutil/fileutil_unix.go
@@ -100,14 +100,14 @@ func GetDiskSpaceInfo() (diskSpaceInfo DiskSpaceInfo,
syscall.Statfs(wd, &stat)
// get block size
- bSize := uint64(stat.Bsize)
+ bSize := uint64(stat.F_bsize)
// return DiskSpaceInfo with calculated bytes
return DiskSpaceInfo{
// On Linux the struct statfs.f_bavail field is unsigned, but on FreeBSD the field is an int64
- AvailBytes: (int64)((uint64)(stat.Bavail) * bSize), // available space = # of available blocks * block size
- FreeBytes: (int64)(stat.Bfree * bSize), // free space = # of free blocks * block size
- TotalBytes: (int64)(stat.Blocks * bSize), // total space = # of total blocks * block size
+ AvailBytes: (int64)((uint64)(stat.F_bavail) * bSize), // available space = # of available blocks * block size
+ FreeBytes: (int64)(stat.F_bfree * bSize), // free space = # of free blocks * block size
+ TotalBytes: (int64)(stat.F_blocks * bSize), // total space = # of total blocks * block size
}, nil
}