zone plugin: Undefine _FILE_OFFSET_BITS when building on 32bit hosts.
[collectd.git] / src / zone.c
index b8cc919..188fbe3 100644 (file)
  *   Dagobert Michelsen (forward-porting)
  **/
 
-#define _BSD_SOURCE
+#if HAVE_CONFIG_H
+# include "config.h"
+# undef HAVE_CONFIG_H
+#endif
+/* avoid procfs.h error "Cannot use procfs in the large file compilation environment" */
+#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+#  undef _FILE_OFFSET_BITS
+#  undef _LARGEFILE64_SOURCE
+#endif
 
 #include "collectd.h"
 #include "common.h"
@@ -155,7 +163,8 @@ zone_scandir(DIR *procdir)
                return(NULL);
        }
 
-       for (rewinddir(procdir); (direntp = readdir(procdir)); ) {
+       rewinddir(procdir);
+       while ((direntp = readdir(procdir))) {
                pidstr = direntp->d_name;
                if (pidstr[0] == '.')   /* skip "." and ".."  */
                        continue;