summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMartin Ebourne <martin@ebourne.me.uk>2006-02-23 01:56:02 +0000
committerMartin Ebourne <martin@ebourne.me.uk>2006-02-23 01:56:02 +0000
commita167a7dc42bd3765fe77b615a1226b4a0c3f6731 (patch)
treec53dedb531e1db2d771abe0b670cbc842c747654 /bin
parent5839c5a7fc2d84cb544cd372707dc2fa21f2f074 (diff)
Patch from Per Thomsen to detect statvfs. This is used by recent versions of NetBSD in preference to statfs.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupd/BackupDaemon.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp
index 01e5bf36..3152d82d 100644
--- a/bin/bbackupd/BackupDaemon.cpp
+++ b/bin/bbackupd/BackupDaemon.cpp
@@ -1170,7 +1170,7 @@ void BackupDaemon::SendSyncStartOrFinish(bool SendStart)
-#ifndef HAVE_STRUCT_STATFS_F_MNTONNAME
+#if !defined(HAVE_STRUCT_STATFS_F_MNTONNAME) && !defined(HAVE_STRUCT_STATVFS_F_NMTONNAME)
// string comparison ordering for when mount points are handled
// by code, rather than the OS.
typedef struct
@@ -1234,7 +1234,7 @@ void BackupDaemon::SetupLocations(BackupClientContext &rClientContext, const Con
int numIDMaps = 0;
#ifdef HAVE_MOUNTS
-#ifndef HAVE_STRUCT_STATFS_F_MNTONNAME
+#if !defined(HAVE_STRUCT_STATFS_F_MNTONNAME) && !defined(HAVE_STRUCT_STATVFS_F_MNTONNAME)
// Linux and others can't tell you where a directory is mounted. So we
// have to read the mount entries from /etc/mtab! Bizarre that the OS
// itself can't tell you, but there you go.
@@ -1308,7 +1308,7 @@ void BackupDaemon::SetupLocations(BackupClientContext &rClientContext, const Con
ASSERT(*i == "/");
}
#endif // n NDEBUG
-#endif // n HAVE_STRUCT_STATFS_F_MNTONNAME
+#endif // n HAVE_STRUCT_STATFS_F_MNTONNAME || n HAVE_STRUCT_STATVFS_F_MNTONNAME
#endif // HAVE_MOUNTS
// Then... go through each of the entries in the configuration,
@@ -1332,11 +1332,16 @@ TRACE0("new location\n");
// Do a fsstat on the pathname to find out which mount it's on
{
-#if defined HAVE_STRUCT_STATFS_F_MNTONNAME || defined WIN32
+#if defined HAVE_STRUCT_STATFS_F_MNTONNAME || defined HAVE_STRUCT_STATVFS_F_MNTONNAME || defined WIN32
// BSD style statfs -- includes mount point, which is nice.
+#ifdef HAVE_STRUCT_STATVFS_F_MNTONNAME
+ struct statvfs s;
+ if(::statvfs(ploc->mPath.c_str(), &s) != 0)
+#else // HAVE_STRUCT_STATVFS_F_MNTONNAME
struct statfs s;
if(::statfs(ploc->mPath.c_str(), &s) != 0)
+#endif // HAVE_STRUCT_STATVFS_F_MNTONNAME
{
THROW_EXCEPTION(CommonException, OSFileError)
}