X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdf.c;h=22264d30228f5f8d8f5946beec819f20844cfd7f;hb=ead8b249e18e5e5eff16b6260d880f4421404c4e;hp=9d53b0b67eb7c326d3b1811682144d2a7cb6b14b;hpb=8a81e4d5907c43d22a808dbfe088eb4ddab2a16b;p=collectd.git diff --git a/src/df.c b/src/df.c index 9d53b0b6..22264d30 100644 --- a/src/df.c +++ b/src/df.c @@ -287,9 +287,11 @@ static int df_read (void) * report negative free space for user. Notice. blk_reserved * will start to diminish after this. */ #if HAVE_STATVFS - /* Cast is needed to avoid compiler warnings. + /* Cast and temporary variable are needed to avoid + * compiler warnings. * ((struct statvfs).f_bavail is unsigned (POSIX)) */ - if (((int64_t) statbuf.f_bavail) < 0) + int64_t signed_bavail = (int64_t) statbuf.f_bavail; + if (signed_bavail < 0) statbuf.f_bavail = 0; #elif HAVE_STATFS if (statbuf.f_bavail < 0)