[dovecot-cvs] dovecot/src/lib mountpoint.c,1.7,1.8

tss at dovecot.org tss at dovecot.org
Fri Nov 3 14:05:23 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv23111/src/lib

Modified Files:
	mountpoint.c 
Log Message:
Added support for statvfs(), which is what the newer BSDs use.



Index: mountpoint.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mountpoint.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mountpoint.c	11 Oct 2006 10:33:20 -0000	1.7
+++ mountpoint.c	3 Nov 2006 14:05:21 -0000	1.8
@@ -5,9 +5,14 @@
 
 #include <sys/stat.h>
 
-#ifdef HAVE_STATFS_MNTFROMNAME
-#  include <sys/param.h> /* BSDs */
+#ifdef HAVE_STATVFS_MNTFROMNAME
+#  include <sys/statvfs.h> /* NetBSD 3.0+, FreeBSD 5.0+ */
+#  define STATVFS_STR "statvfs"
+#elif HAVE_STATFS_MNTFROMNAME
+#  include <sys/param.h> /* Older BSDs */
 #  include <sys/mount.h>
+#  define statvfs statfs
+#  define STATVFS_STR "statfs"
 #elif defined(HAVE_MNTENT_H)
 #  include <stdio.h>
 #  include <mntent.h> /* Linux */
@@ -38,16 +43,16 @@
 	memset(point_r, 0, sizeof(*point_r));
 	errno = ENOSYS;
 	return -1;
-#elif defined (HAVE_STATFS_MNTFROMNAME)
+#elif defined (HAVE_STATFS_MNTFROMNAME) || defined(HAVE_STATVFS_MNTFROMNAME)
 	/* BSDs */
-	struct statfs buf;
+	struct statvfs buf;
 
 	memset(point_r, 0, sizeof(*point_r));
-	if (statfs(path, &buf) < 0) {
+	if (statvfs(path, &buf) < 0) {
 		if (errno == ENOENT)
 			return 0;
 
-		i_error("statfs(%s) failed: %m", path);
+		i_error(STATVFS_STR"(%s) failed: %m", path);
 		return -1;
 	}
 



More information about the dovecot-cvs mailing list