aboutsummaryrefslogtreecommitdiffstats
path: root/x11/kdelibs2/files/patch-global.cpp
blob: 13636e36b43a097680f37b64790ef1bced48da89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- kio/global.cpp.orig	Thu Dec  7 14:52:15 2000
+++ kio/global.cpp	Thu Dec  7 14:52:29 2000
@@ -28,6 +28,12 @@
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#endif
+
 #ifdef HAVE_FSTAB_H
 #include <fstab.h>
 #endif
@@ -423,6 +429,30 @@
 
     /* Get the list of mounted file systems */
 
+#ifdef __FreeBSD__
+
+    QString result;
+    struct statfs *mounted;
+
+    int num_fs = getmntinfo(&mounted, MNT_NOWAIT);
+
+    for (int i=0;i<num_fs;i++) {
+
+      QCString device_name = mounted[i].f_mntfromname;
+
+      // If the path contains symlinks, get
+      // the real name
+      if (realpath(device_name, realpath_buffer) != 0)
+          // succes, use result from realpath
+         device_name = realpath_buffer;
+
+      if (realname == device_name) {
+        result = mounted[i].f_mntonname;
+	break;
+      }
+    }
+
+#else
     if ((mtab = SETMNTENT(MNTTAB, "r")) == 0) {
         perror("setmntent");
         return QString::null;
@@ -467,6 +497,7 @@
 
     ENDMNTENT(mtab);
     //kdDebug( 7007 ) << "Returning result " << result << endl;
+#endif
     return result;
 }