From 505a4bb6b15975ddf3d831cbee35cf070a2a687e Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 1 Nov 2011 16:17:15 +0100 Subject: [PATCH] Use statfs64 for $fs_* to support very large volumes bug reported by puppetm. --- src/fs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fs.c b/src/fs.c index 2152552b..b982a99c 100644 --- a/src/fs.c +++ b/src/fs.c @@ -118,20 +118,20 @@ struct fs_stat *prepare_fs_stat(const char *s) static void update_fs_stat(struct fs_stat *fs) { - struct statfs s; + struct statfs64 s; - if (statfs(fs->path, &s) == 0) { + if (statfs64(fs->path, &s) == 0) { fs->size = (long long)s.f_blocks * s.f_bsize; /* bfree (root) or bavail (non-roots) ? */ fs->avail = (long long)s.f_bavail * s.f_bsize; fs->free = (long long)s.f_bfree * s.f_bsize; get_fs_type(fs->path, fs->type); } else { + NORM_ERR("statfs64 '%s': %s", fs->path, strerror(errno)); fs->size = 0; fs->avail = 0; fs->free = 0; strncpy(fs->type, "unknown", DEFAULT_TEXT_BUFFER_SIZE); - NORM_ERR("statfs '%s': %s", fs->path, strerror(errno)); } }