openbsd-ports/devel/glib2/patches/patch-gio_gunixmount_c
ajacoutot 52866d0dcb Rework the mount/unmount functions.
Remove useless patches while here.
2011-06-28 09:40:13 +00:00

59 lines
1.6 KiB
Plaintext

$OpenBSD: patch-gio_gunixmount_c,v 1.4 2011/06/28 09:40:13 ajacoutot Exp $
https://bugzilla.gnome.org/show_bug.cgi?id=653553
https://bugzilla.gnome.org/show_bug.cgi?id=653555
--- gio/gunixmount.c.orig Sat Nov 6 16:38:54 2010
+++ gio/gunixmount.c Tue Jun 28 10:18:02 2011
@@ -29,6 +29,12 @@
#include <sys/wait.h>
#include <unistd.h>
+#ifdef __OpenBSD__
+#include <errno.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
+
#include <glib.h>
#include "gunixvolumemonitor.h"
#include "gunixmount.h"
@@ -423,8 +429,14 @@ g_unix_mount_unmount (GMount *mount,
gpointer user_data)
{
GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
- char *argv[] = {"umount", NULL, NULL};
+ gchar *umount;
+ umount = g_find_program_in_path("umount");
+ if (!umount)
+ umount = "/sbin/umount";
+
+ char *argv[] = {umount, NULL, NULL};
+
if (unix_mount->mount_path != NULL)
argv[1] = unix_mount->mount_path;
else
@@ -451,10 +463,21 @@ g_unix_mount_eject (GMount *mount,
GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
char *argv[] = {"eject", NULL, NULL};
+/*
+ * eject(1) on OpenBSD does not try to unmount first and only works on
+ * devices, not mount points.
+ */
+#ifdef __OpenBSD__
+ if (unmount(unix_mount->mount_path, MNT_FORCE) < 0)
+ g_warning ("%s unmount failed: %s\n", unix_mount->mount_path, strerror(errno));
+
+ argv[1] = unix_mount->device_path;
+#else
if (unix_mount->mount_path != NULL)
argv[1] = unix_mount->mount_path;
else
argv[1] = unix_mount->device_path;
+#endif
eject_unmount_do (mount, cancellable, callback, user_data, argv);
}