ba67c8595ea93248bbf03b6c1ec4f6222f528131
[pkgsrc.git] / comms / plptools / patches / patch-ab
1 $NetBSD: patch-ab,v 1.6 2006/02/02 15:03:19 joerg Exp $
2
3 --- plpnfsd/mp_mount.c.orig     2002-07-12 14:45:41.000000000 +0000
4 +++ plpnfsd/mp_mount.c
5 @@ -21,7 +21,7 @@ extern int inet_addr(char *);
6  #define PORTMAP                        /* I need svcudp_create in rpc/svc_soc.h, sol 2.4 */
7  #endif
8  
9 -#include <OSdefs.h>
10 +#include "OSdefs.h"
11  #include <stdio.h>
12  #include <signal.h>
13  #include <sys/stat.h>
14 @@ -31,7 +31,7 @@ extern int inet_addr(char *);
15  #include <bstring.h>
16  #endif
17  
18 -#if defined(__NetBSD__) || defined(__FreeBSD__)
19 +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
20  #include <sys/param.h>         /* Needs NGROUPS for mount.h */
21  #define umount(dir) unmount(dir, 1)
22  #endif
23 @@ -47,22 +47,33 @@ extern int inet_addr(char *);
24  static char nfshost[128];
25  
26  #define NFSCLIENT
27 -#ifdef __FreeBSD__
28 +#if defined(__FreeBSD__) || defined(__DragonFly__)
29  #define NFS
30  #endif                         /* __FreeBSD__ */
31  #include <sys/mount.h>
32  
33 -#ifdef __FreeBSD__
34 +#if defined(__FreeBSD__) || defined(__DragonFly__)
35  #include <sys/socket.h>
36  #include <netinet/in.h>
37  #include <arpa/inet.h>
38  #include <rpc/rpc.h>
39  #include <nfs/rpcv2.h>
40 -#if __FreeBSD_version >= 300001
41 +#if defined(__DragonFly__) || __FreeBSD_version >= 300001
42  #include <nfs/nfs.h>
43  #endif
44  #endif                         /* __FreeBSD__ */
45  
46 +#ifdef __NetBSD__
47 +#include <sys/socket.h>
48 +#include <netinet/in.h>
49 +#include <arpa/inet.h>
50 +#include <sys/types.h>
51 +#include <stdlib.h>
52 +#include <unistd.h>
53 +#include <strings.h>
54 +#include <nfs/nfsmount.h>
55 +#endif /* __NetBSD__ */
56 +
57  #include <rpc/rpc.h>
58  #include "nfs_prot.h"
59  
60 @@ -156,7 +167,7 @@ static void doexit() {
61         struct mntent *ent;
62  #endif
63  #endif
64 -#ifndef __FreeBSD__
65 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
66         struct stat statb;
67  #endif
68  
69 @@ -277,7 +288,7 @@ mount_and_run(char *dir, void (*proc)(),
70  #else
71         struct nfs_args nfs_args;
72  #endif
73 -#ifdef __FreeBSD__
74 +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
75         int mount_flags;
76  #endif
77  
78 @@ -427,8 +438,8 @@ mount_and_run(char *dir, void (*proc)(),
79             NFSMNT_RETRANS | NFSMNT_TIMEO | NFSMNT_WSIZE | NFSMNT_RSIZE;
80  #endif
81  
82 -#ifdef __FreeBSD__
83 -#if __FreeBSD_version >= 300001
84 +#if defined(__FreeBSD__) || defined(__DragonFly__)
85 +#if defined(__DragonFly__) || __FreeBSD_version >= 300001
86         nfs_args.version = NFS_ARGSVERSION;
87  #endif
88         nfs_args.addr = (struct sockaddr *) &sain;
89 @@ -453,20 +464,23 @@ mount_and_run(char *dir, void (*proc)(),
90  #endif
91  
92  #ifdef __NetBSD__
93 +       nfs_args.version = NFS_ARGSVERSION;
94         nfs_args.addrlen = sizeof(sain);
95         nfs_args.sotype = SOCK_DGRAM;
96         nfs_args.maxgrouplist = NGROUPS;
97         nfs_args.readahead = 1;
98         nfs_args.addr = (struct sockaddr *) &sain;
99         nfs_args.fh = (void *) root_fh;
100 +       nfs_args.fhsize = sizeof(*root_fh);
101         nfs_args.wsize = PBUFSIZE;
102         nfs_args.rsize = PBUFSIZE;
103         nfs_args.retrans = 10;
104         nfs_args.timeo = 600;
105         nfs_args.hostname = PSIONHOSTNAME;
106         nfs_args.flags = NFSMNT_INT | NFSMNT_RETRANS | NFSMNT_TIMEO
107 -           | NFSMNT_NOCONN | NFSMNT_DUMBTIMR | NFSMNT_MYWRITE
108 +           | NFSMNT_NOCONN | NFSMNT_DUMBTIMR
109             | NFSMNT_WSIZE | NFSMNT_RSIZE;
110 +       mount_flags = MNT_NOSUID | MNT_NODEV | MNT_NOEXEC | MNT_NOATIME;
111  #endif
112  
113  #if defined(_IBMR2)
114 @@ -496,7 +510,7 @@ mount_and_run(char *dir, void (*proc)(),
115  #if defined(__sgi) || (defined(sun) && defined(__SVR4))
116                         if (mount("", dir, MS_DATA, "nfs", &nfs_args, sizeof(nfs_args)))
117  #endif
118 -#if defined(__NetBSD__) || defined(__NeXT__)
119 +#if defined(__NeXT__)
120                         if (mount(MOUNT_NFS, dir, 0, (caddr_t) & nfs_args))
121  #endif
122  #ifdef hpux
123 @@ -512,8 +526,8 @@ mount_and_run(char *dir, void (*proc)(),
124                         if (aix3_mount("psion:loc", dir, 0, MOUNT_TYPE_NFS, &nfs_args, "plpnfsd"))
125  #endif
126  
127 -#ifdef __FreeBSD__
128 -#if __FreeBSD_version >= 300001
129 +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
130 +#if defined(__DragonFly__) || __FreeBSD_version >= 300001
131                         if (mount("nfs", dir, mount_flags, &nfs_args))
132  #else
133                         if (mount(MOUNT_NFS, dir, mount_flags, &nfs_args))