| @@ -1,128 +1,125 @@ | | | @@ -1,128 +1,125 @@ |
1 | $NetBSD: patch-ab,v 1.2 2008/12/25 05:33:20 hasso Exp $ | | 1 | $NetBSD: patch-ab,v 1.3 2009/03/10 05:24:36 dsainty Exp $ |
2 | | | 2 | |
3 | --- src/gnome-mount.c.orig 2008-04-17 02:41:32 +0300 | | 3 | --- src/gnome-mount.c.orig 2008-04-17 11:41:32.000000000 +1200 |
4 | +++ src/gnome-mount.c 2008-12-24 22:39:47 +0200 | | 4 | +++ src/gnome-mount.c 2009-03-10 17:11:00.000000000 +1300 |
5 | @@ -31,6 +31,10 @@ | | 5 | @@ -30,6 +30,7 @@ |
| | | 6 | #include <fcntl.h> |
6 | #include <string.h> | | 7 | #include <string.h> |
7 | #include <stdlib.h> | | 8 | #include <stdlib.h> |
8 | | | | |
9 | +#ifdef __NetBSD__ | | | |
10 | +#include <locale.h> | | 9 | +#include <locale.h> |
11 | +#endif | | 10 | |
12 | + | | | |
13 | #include <dbus/dbus.h> | | 11 | #include <dbus/dbus.h> |
14 | #include <dbus/dbus-glib-lowlevel.h> | | 12 | #include <dbus/dbus-glib-lowlevel.h> |
15 | #include <libhal.h> | | 13 | @@ -51,9 +52,9 @@ |
16 | @@ -51,9 +55,9 @@ | | | |
17 | #define NOTIFY_EXPIRES_DEFAULT -1 | | 14 | #define NOTIFY_EXPIRES_DEFAULT -1 |
18 | #endif | | 15 | #endif |
19 | | | 16 | |
20 | -#if !defined(sun) && !defined(__FreeBSD__) | | 17 | -#if !defined(sun) && !defined(__FreeBSD__) |
21 | +#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) | | 18 | +#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) |
22 | #include <mntent.h> | | 19 | #include <mntent.h> |
23 | -#elif defined(__FreeBSD__) | | 20 | -#elif defined(__FreeBSD__) |
24 | +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 21 | +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
25 | #include <fstab.h> | | 22 | #include <fstab.h> |
26 | #include <sys/param.h> | | 23 | #include <sys/param.h> |
27 | #include <sys/ucred.h> | | 24 | #include <sys/ucred.h> |
28 | @@ -677,15 +681,19 @@ static char * | | 25 | @@ -677,15 +678,19 @@ |
29 | get_mntent_mount_point(const char *device_file) | | 26 | get_mntent_mount_point(const char *device_file) |
30 | { | | 27 | { |
31 | char *mount_point; | | 28 | char *mount_point; |
32 | -#if! defined(sun) && !defined(__FreeBSD__) | | 29 | -#if! defined(sun) && !defined(__FreeBSD__) |
33 | +#if! defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) | | 30 | +#if! defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) |
34 | FILE *f; | | 31 | FILE *f; |
35 | struct mntent mnt; | | 32 | struct mntent mnt; |
36 | struct mntent *mnte; | | 33 | struct mntent *mnte; |
37 | char buf[512]; | | 34 | char buf[512]; |
38 | -#elif defined(__FreeBSD__) | | 35 | -#elif defined(__FreeBSD__) |
39 | +#elif defined(__FreeBSD__) || defined(__DragonFly__) | | 36 | +#elif defined(__FreeBSD__) || defined(__DragonFly__) |
40 | struct statfs *mounts; | | 37 | struct statfs *mounts; |
41 | int n_mounts; | | 38 | int n_mounts; |
42 | int i; | | 39 | int i; |
43 | +#elif defined(__NetBSD__) | | 40 | +#elif defined(__NetBSD__) |
44 | + struct statvfs *mounts; | | 41 | + struct statvfs *mounts; |
45 | + int n_mounts; | | 42 | + int n_mounts; |
46 | + int i; | | 43 | + int i; |
47 | #elif defined(sun) | | 44 | #elif defined(sun) |
48 | FILE *f; | | 45 | FILE *f; |
49 | struct mnttab mnt; | | 46 | struct mnttab mnt; |
50 | @@ -694,7 +702,7 @@ get_mntent_mount_point(const char *devic | | 47 | @@ -694,7 +699,7 @@ |
51 | | | 48 | |
52 | mount_point = NULL; | | 49 | mount_point = NULL; |
53 | | | 50 | |
54 | -#if !defined(sun) && !defined(__FreeBSD__) | | 51 | -#if !defined(sun) && !defined(__FreeBSD__) |
55 | +#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) | | 52 | +#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) |
56 | if ((f = setmntent ("/proc/mounts", "r")) != NULL) { | | 53 | if ((f = setmntent ("/proc/mounts", "r")) != NULL) { |
57 | | | 54 | |
58 | while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) { | | 55 | while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) { |
59 | @@ -717,13 +725,13 @@ get_mntent_mount_point(const char *devic | | 56 | @@ -717,13 +722,13 @@ |
60 | } | | 57 | } |
61 | fclose(f); | | 58 | fclose(f); |
62 | } | | 59 | } |
63 | -#elif defined(__FreeBSD__) | | 60 | -#elif defined(__FreeBSD__) |
64 | +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 61 | +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
65 | n_mounts = getmntinfo(&mounts, MNT_NOWAIT); | | 62 | n_mounts = getmntinfo(&mounts, MNT_NOWAIT); |
66 | for (i = 0; i < n_mounts; i++) { | | 63 | for (i = 0; i < n_mounts; i++) { |
67 | if (!strcmp(mounts[i].f_mntfromname, device_file)) | | 64 | if (!strcmp(mounts[i].f_mntfromname, device_file)) |
68 | mount_point = g_strdup (mounts[i].f_mntonname); | | 65 | mount_point = g_strdup (mounts[i].f_mntonname); |
69 | } | | 66 | } |
70 | -#endif /* sun && __FreeBSD__ */ | | 67 | -#endif /* sun && __FreeBSD__ */ |
71 | +#endif /* sun && __FreeBSD__ && __NetBSD__ && __DragonFly__ */ | | 68 | +#endif /* sun && __FreeBSD__ && __NetBSD__ && __DragonFly__ */ |
72 | | | 69 | |
73 | out: | | 70 | out: |
74 | return (mount_point); | | 71 | return (mount_point); |
75 | @@ -862,7 +870,7 @@ out: | | 72 | @@ -862,7 +867,7 @@ |
76 | static gboolean | | 73 | static gboolean |
77 | fstab_open (gpointer *handle) | | 74 | fstab_open (gpointer *handle) |
78 | { | | 75 | { |
79 | -#ifdef __FreeBSD__ | | 76 | -#ifdef __FreeBSD__ |
80 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 77 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
81 | return setfsent () == 1; | | 78 | return setfsent () == 1; |
82 | #else | | 79 | #else |
83 | *handle = fopen ("/etc/fstab", "r"); | | 80 | *handle = fopen ("/etc/fstab", "r"); |
84 | @@ -873,7 +881,7 @@ fstab_open (gpointer *handle) | | 81 | @@ -873,7 +878,7 @@ |
85 | static char * | | 82 | static char * |
86 | fstab_next (gpointer handle, char **mount_point) | | 83 | fstab_next (gpointer handle, char **mount_point) |
87 | { | | 84 | { |
88 | -#ifdef __FreeBSD__ | | 85 | -#ifdef __FreeBSD__ |
89 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 86 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
90 | struct fstab *fstab; | | 87 | struct fstab *fstab; |
91 | | | 88 | |
92 | fstab = getfsent (); | | 89 | fstab = getfsent (); |
93 | @@ -901,7 +909,7 @@ fstab_next (gpointer handle, char **moun | | 90 | @@ -901,7 +906,7 @@ |
94 | static void | | 91 | static void |
95 | fstab_close (gpointer handle) | | 92 | fstab_close (gpointer handle) |
96 | { | | 93 | { |
97 | -#ifdef __FreeBSD__ | | 94 | -#ifdef __FreeBSD__ |
98 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 95 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
99 | endfsent (); | | 96 | endfsent (); |
100 | #else | | 97 | #else |
101 | fclose (handle); | | 98 | fclose (handle); |
102 | @@ -1116,7 +1124,7 @@ out: | | 99 | @@ -1116,7 +1121,7 @@ |
103 | return ret; | | 100 | return ret; |
104 | } | | 101 | } |
105 | | | 102 | |
106 | -#ifdef __FreeBSD__ | | 103 | -#ifdef __FreeBSD__ |
107 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) | | 104 | +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) |
108 | #define MOUNT "/sbin/mount" | | 105 | #define MOUNT "/sbin/mount" |
109 | #define UMOUNT "/sbin/umount" | | 106 | #define UMOUNT "/sbin/umount" |
110 | #else | | 107 | #else |
111 | @@ -1451,7 +1459,7 @@ volume_mount (const char *udi, LibHalVol | | 108 | @@ -1451,7 +1456,7 @@ |
112 | if (volume == NULL && (mount_options->len == 0)) { | | 109 | if (volume == NULL && (mount_options->len == 0)) { |
113 | /* volume from a non-pollable drive, just set uid.. */ | | 110 | /* volume from a non-pollable drive, just set uid.. */ |
114 | | | 111 | |
115 | -#ifndef __FreeBSD__ | | 112 | -#ifndef __FreeBSD__ |
116 | +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) | | 113 | +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) |
117 | snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); | | 114 | snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ()); |
118 | #else | | 115 | #else |
119 | snprintf (uidbuf, sizeof (uidbuf) - 1, "-u=%u", getuid ()); | | 116 | snprintf (uidbuf, sizeof (uidbuf) - 1, "-u=%u", getuid ()); |
120 | @@ -1482,7 +1490,7 @@ volume_mount (const char *udi, LibHalVol | | 117 | @@ -1482,7 +1487,7 @@ |
121 | g_debug ("read default option '%s' from gconf strlist key %s", option, key); | | 118 | g_debug ("read default option '%s' from gconf strlist key %s", option, key); |
122 | | | 119 | |
123 | /* special workaround to replace "uid=" with "uid=<actual uid of caller>" */ | | 120 | /* special workaround to replace "uid=" with "uid=<actual uid of caller>" */ |
124 | -#ifndef __FreeBSD__ | | 121 | -#ifndef __FreeBSD__ |
125 | +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) | | 122 | +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) |
126 | if (strcmp (option, "uid=") == 0) { | | 123 | if (strcmp (option, "uid=") == 0) { |
127 | g_free (option); | | 124 | g_free (option); |
128 | option = g_strdup_printf ("uid=%u", getuid ()); | | 125 | option = g_strdup_printf ("uid=%u", getuid ()); |