summaryrefslogtreecommitdiff
path: root/filesystems/fuse-chironfs/patches/patch-ac
blob: 5cfabab75daf72906356dd24f7969d7fd85104f4 (plain)
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
74
75
$NetBSD: patch-ac,v 1.1.1.1 2007/11/27 18:55:40 pooka Exp $

--- src/chironfs.c.orig	2007-11-27 17:00:15.000000000 +0100
+++ src/chironfs.c	2007-11-27 19:08:07.000000000 +0100
@@ -27,8 +27,7 @@
 #define FUSE_USE_VERSION 25
 
 #include <fuse.h>
-#include <fuse/fuse.h>
-#include <fuse/fuse_opt.h>
+#include <fuse_opt.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -43,13 +42,17 @@
 #ifdef HAVE_SETXATTR
 #include <sys/xattr.h>
 #endif
+#ifdef __linux__
 #include <linux/limits.h>
 #include <mntent.h>
-#include <stdint.h>
 #include <bits/wordsize.h>
+#endif
+#include <stdint.h>
 #include <pwd.h>
 #include <grp.h>
 
+#include "config.h"
+
 #define _CHIRON_H_
 #include "chironfs.h"
 
@@ -186,6 +189,16 @@
    }
 }
 
+char *do_realpath(const char *path, char *resolvedpath)
+{
+
+#ifndef __linux__
+   if (resolvedpath == NULL)
+      resolvedpath = malloc(PATH_MAX);
+#endif
+   return realpath(path, resolvedpath);
+}
+
 ////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////
 //
@@ -2234,7 +2247,7 @@
          return(NULL);
       }
    } else {
-      realbasedir = realpath(basedir,NULL);
+      realbasedir = do_realpath(basedir,NULL);
       if (realbasedir==NULL) {
          free(basedir);
          return(NULL);
@@ -2383,6 +2396,7 @@
          dbg(("\nfuse_argv: %s %s %s", fuse_argv[0], fuse_argv[1], fuse_argv[2]));
          dbg(("\n-------------------------------------------------------------------------------"));
 
+#ifdef HAVE_GETMNTENT
          FILE *mtab;
          struct mntent *mntentry;
          mtab = setmntent("/etc/mtab", "r");
@@ -2393,6 +2407,7 @@
             }
          } while(mntentry!=NULL);
          endmntent (mtab);
+#endif
          dbg(("\n-------------------------------------------------------------------------------"));
 
          res = fuse_main(3, fuse_argv, &chiron_oper);