X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdf.c;h=5c08ca4a145bdf91ccb514b3e36a7da4d0efd582;hb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;hp=dd90f243343396ec5742288bceff12d4e34e5de6;hpb=1035fba8812893e50d00a871e3399cc1ece3b384;p=collectd.git diff --git a/src/df.c b/src/df.c index dd90f243..5c08ca4a 100644 --- a/src/df.c +++ b/src/df.c @@ -55,10 +55,10 @@ static ignorelist_t *il_device = NULL; static ignorelist_t *il_mountpoint = NULL; static ignorelist_t *il_fstype = NULL; -static _Bool by_device = 0; -static _Bool report_inodes = 0; -static _Bool values_absolute = 1; -static _Bool values_percentage = 0; +static bool by_device = 0; +static bool report_inodes = 0; +static bool values_absolute = 1; +static bool values_percentage = 0; static int df_init(void) { if (il_device == NULL) @@ -152,6 +152,7 @@ static int df_read(void) { #elif HAVE_STATFS struct statfs statbuf; #endif + int retval = 0; /* struct STATANYFS statbuf; */ cu_mount_t *mnt_list; @@ -202,9 +203,7 @@ static int df_read(void) { continue; if (STATANYFS(mnt_ptr->dir, &statbuf) < 0) { - char errbuf[1024]; - ERROR(STATANYFS_STR "(%s) failed: %s", mnt_ptr->dir, - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR(STATANYFS_STR "(%s) failed: %s", mnt_ptr->dir, STRERRNO); continue; } @@ -284,8 +283,10 @@ static int df_read(void) { (gauge_t)((float_t)(blk_reserved) / statbuf.f_blocks * 100)); df_submit_one(disk_name, "percent_bytes", "used", (gauge_t)((float_t)(blk_used) / statbuf.f_blocks * 100)); - } else - return -1; + } else { + retval = -1; + break; + } } /* inode handling */ @@ -315,8 +316,10 @@ static int df_read(void) { df_submit_one( disk_name, "percent_inodes", "used", (gauge_t)((float_t)(inode_used) / statbuf.f_files * 100)); - } else - return -1; + } else { + retval = -1; + break; + } } if (values_absolute) { df_submit_one(disk_name, "df_inodes", "free", (gauge_t)inode_free); @@ -329,7 +332,7 @@ static int df_read(void) { cu_mount_freelist(mnt_list); - return 0; + return retval; } /* int df_read */ void module_register(void) {