pkgsrc/sysutils/gnome-mount/patches/patch-ab
dsainty 2b23ac1fa3 Make include of <locale.h> unconditional. That's the way it is at the source,
and it's necessary to fix the build in at least some Linux environments.

http://bugzilla.gnome.org/show_bug.cgi?id=442197
http://svn.gnome.org/viewvc/gnome-mount/trunk/src/gnome-mount.c?r1=183&r2=184

No PKGREVISION bump required, this change only affects platforms where the
build was broken anyway.
2009-03-10 05:24:35 +00:00

125 lines
3.7 KiB
Text

$NetBSD: patch-ab,v 1.3 2009/03/10 05:24:36 dsainty Exp $
--- src/gnome-mount.c.orig 2008-04-17 11:41:32.000000000 +1200
+++ src/gnome-mount.c 2009-03-10 17:11:00.000000000 +1300
@@ -30,6 +30,7 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
+#include <locale.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -51,9 +52,9 @@
#define NOTIFY_EXPIRES_DEFAULT -1
#endif
-#if !defined(sun) && !defined(__FreeBSD__)
+#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
#include <mntent.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <fstab.h>
#include <sys/param.h>
#include <sys/ucred.h>
@@ -677,15 +678,19 @@
get_mntent_mount_point(const char *device_file)
{
char *mount_point;
-#if! defined(sun) && !defined(__FreeBSD__)
+#if! defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
FILE *f;
struct mntent mnt;
struct mntent *mnte;
char buf[512];
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
struct statfs *mounts;
int n_mounts;
int i;
+#elif defined(__NetBSD__)
+ struct statvfs *mounts;
+ int n_mounts;
+ int i;
#elif defined(sun)
FILE *f;
struct mnttab mnt;
@@ -694,7 +699,7 @@
mount_point = NULL;
-#if !defined(sun) && !defined(__FreeBSD__)
+#if !defined(sun) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
if ((f = setmntent ("/proc/mounts", "r")) != NULL) {
while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) {
@@ -717,13 +722,13 @@
}
fclose(f);
}
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
n_mounts = getmntinfo(&mounts, MNT_NOWAIT);
for (i = 0; i < n_mounts; i++) {
if (!strcmp(mounts[i].f_mntfromname, device_file))
mount_point = g_strdup (mounts[i].f_mntonname);
}
-#endif /* sun && __FreeBSD__ */
+#endif /* sun && __FreeBSD__ && __NetBSD__ && __DragonFly__ */
out:
return (mount_point);
@@ -862,7 +867,7 @@
static gboolean
fstab_open (gpointer *handle)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
return setfsent () == 1;
#else
*handle = fopen ("/etc/fstab", "r");
@@ -873,7 +878,7 @@
static char *
fstab_next (gpointer handle, char **mount_point)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
struct fstab *fstab;
fstab = getfsent ();
@@ -901,7 +906,7 @@
static void
fstab_close (gpointer handle)
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
endfsent ();
#else
fclose (handle);
@@ -1116,7 +1121,7 @@
return ret;
}
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#define MOUNT "/sbin/mount"
#define UMOUNT "/sbin/umount"
#else
@@ -1451,7 +1456,7 @@
if (volume == NULL && (mount_options->len == 0)) {
/* volume from a non-pollable drive, just set uid.. */
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
snprintf (uidbuf, sizeof (uidbuf) - 1, "uid=%u", getuid ());
#else
snprintf (uidbuf, sizeof (uidbuf) - 1, "-u=%u", getuid ());
@@ -1482,7 +1487,7 @@
g_debug ("read default option '%s' from gconf strlist key %s", option, key);
/* special workaround to replace "uid=" with "uid=<actual uid of caller>" */
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
if (strcmp (option, "uid=") == 0) {
g_free (option);
option = g_strdup_printf ("uid=%u", getuid ());