aebf40
diff --git a/src/util/fsspace.c b/src/util/fsspace.c
aebf40
index 50a4aa7..beef3db 100644
aebf40
--- a/src/util/fsspace.c
aebf40
+++ b/src/util/fsspace.c
aebf40
@@ -91,8 +91,15 @@ void    fsspace(const char *path, struct fsspace * sp)
aebf40
 
aebf40
     if (statvfs(path, &fsbuf) < 0)
aebf40
 	msg_fatal("statvfs %s: %m", path);
aebf40
-    sp->block_size = fsbuf.f_frsize;
aebf40
-    sp->block_free = fsbuf.f_bavail;
aebf40
+    if (fsbuf.f_frsize > 0)
aebf40
+	sp->block_size = fsbuf.f_frsize;
aebf40
+    else
aebf40
+	sp->block_size = fsbuf.f_bsize;
aebf40
+    /* 4G of FS blocks is surely enough space to put a mail in */
aebf40
+    sp->block_free = 0;
aebf40
+    sp->block_free = ~sp->block_free;
aebf40
+    if (fsbuf.f_bavail < sp->block_free)
aebf40
+	sp->block_free = fsbuf.f_bavail;
aebf40
 #endif
aebf40
     if (msg_verbose)
aebf40
 	msg_info("%s: %s: block size %lu, blocks free %lu",
aebf40
diff --git a/src/util/sys_defs.h b/src/util/sys_defs.h
eaa7a1
index a8d2571..ad07498 100644
aebf40
--- a/src/util/sys_defs.h
aebf40
+++ b/src/util/sys_defs.h
eaa7a1
@@ -769,8 +769,8 @@ extern int initgroups(const char *, int);
aebf40
 #define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
aebf40
 #define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
aebf40
 #define FIONREAD_IN_TERMIOS_H
aebf40
-#define USE_STATFS
aebf40
-#define STATFS_IN_SYS_VFS_H
aebf40
+#define USE_STATVFS
aebf40
+#define STATVFS_IN_SYS_STATVFS_H
aebf40
 #define PREPEND_PLUS_TO_OPTSTRING
aebf40
 #define HAS_POSIX_REGEXP
aebf40
 #define HAS_DLOPEN