aboutsummaryrefslogtreecommitdiff
path: root/editors/openoffice.org-2.0/files/patch-sal::osl::unx::file.c
blob: ade5f14b7946556d11f624d19440f003b6813cf6 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- ../sal/osl/unx/file.c.orig	Thu Oct  4 15:09:21 2001
+++ ../sal/osl/unx/file.c
@@ -123,11 +123,16 @@
 #include <ctype.h>
 static const sal_Char* MOUNTTAB="/etc/mtab";
 
-#elif defined(NETBSD)
+#elif defined(NETBSD) || defined(FREEBSD)
+#include <sys/param.h>
+#include <sys/ucred.h>
 #include <sys/mount.h>
 #include <ufs/ufs/quota.h>
 #include <ctype.h>
-static const sal_Char* MOUNTTAB="/etc/mtab"; 
+#define  HAVE_STATFS_H
+/* No mounting table on *BSD
+ * This information is stored only in the kernel. */
+/* static const sal_Char* MOUNTTAB="/etc/mtab"; */
 
 #elif defined(IRIX)
 #include <mntent.h>
@@ -137,7 +142,7 @@
 #include <ctype.h>
 static const sal_Char* MOUNTTAB="/etc/mtab";
 
-#elif defined(MACOSX) || defined(FREEBSD)
+#elif defined(MACOSX) 
 #include <ufs/ufs/quota.h>
 #include <ctype.h>
 static const sal_Char* MOUNTTAB="/etc/mtab";
@@ -4224,10 +4229,20 @@
     mntfile = fopen(MOUNTTAB,"r");
 #endif /* SOLARIS */
 
+#if defined(NETBSD) || defined(FREEBSD)
+    struct statfs *mntbufp;
+    int mntentries,i;
+    mntentries = getmntinfo(&mntbufp,MNT_WAIT);
 
     buffer[0] = '\0';
     
+    if(mntentries == 0)
+#else    
+
+    buffer[0] = '\0';
+
     if ( mntfile == 0 )
+#endif
     {
         nRet=errno;
 #ifdef DEBUG_OSL_FILE
@@ -4286,7 +4301,21 @@
     }
 #endif /* SOLARIS */
 
+#if defined(NETBSD) || defined(FREEBSD)
+    i=0;
+    while ( i < mntentries )
+    {
+       if ( strcmp(mntbufp[i].f_mntonname,buffer) == 0 )
+       {
+           *bMountPoint=sal_True;
+           return osl_File_E_None;
+       }
+       i++;
+    }
+#endif
+#if ! ( defined(NETBSD) || defined(FREEBSD) )
     fclose(mntfile);
+#endif
     *bMountPoint=sal_False;
     return osl_File_E_None;
 }