author | Rich Felker <dalias@aerifal.cx> | 2013年07月19日 02:48:18 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013年07月19日 02:48:18 -0400 |
commit | 6567db65f495cf7c11f5c1e60a3e54543d5a69bc (patch) | |
tree | 37b05447d32a30ac2ff47353d4e499abec339578 /src | |
parent | 648c3b4e18b2ce2b6af7d44783e42ca267ea49f5 (diff) | |
download | musl-6567db65f495cf7c11f5c1e60a3e54543d5a69bc.tar.gz |
-rw-r--r-- | src/stat/statvfs.c | 7 |
diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c index 637bf82f..30d58797 100644 --- a/src/stat/statvfs.c +++ b/src/stat/statvfs.c @@ -5,6 +5,7 @@ int __statfs(const char *path, struct statfs *buf) { + *buf = (struct statfs){0}; #ifdef SYS_statfs64 return syscall(SYS_statfs64, path, sizeof *buf, buf); #else @@ -14,6 +15,7 @@ int __statfs(const char *path, struct statfs *buf) int __fstatfs(int fd, struct statfs *buf) { + *buf = (struct statfs){0}; #ifdef SYS_fstatfs64 return syscall(SYS_fstatfs64, fd, sizeof *buf, buf); #else @@ -26,14 +28,15 @@ weak_alias(__fstatfs, fstatfs); static void fixup(struct statvfs *out, const struct statfs *in) { + *out = (struct statvfs){0}; out->f_bsize = in->f_bsize; - out->f_frsize = in->f_bsize; + out->f_frsize = in->f_frsize ? in->f_frsize : in->f_bsize; out->f_blocks = in->f_blocks; out->f_bfree = in->f_bfree; out->f_bavail = in->f_bavail; out->f_files = in->f_files; out->f_ffree = in->f_ffree; - out->f_favail = 0; + out->f_favail = in->f_ffree; out->f_fsid = in->f_fsid.__val[0]; out->f_flag = in->f_flags; out->f_namemax = in->f_namelen; |