[dovecot-cvs] dovecot/src/lib mountpoint.c,1.4.2.3,1.4.2.4

tss at dovecot.org tss at dovecot.org
Fri Nov 3 14:04:54 UTC 2006


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

Modified Files:
      Tag: branch_1_0
	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.4.2.3
retrieving revision 1.4.2.4
diff -u -d -r1.4.2.3 -r1.4.2.4
--- mountpoint.c	11 Oct 2006 10:33:18 -0000	1.4.2.3
+++ mountpoint.c	3 Nov 2006 14:04:51 -0000	1.4.2.4
@@ -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