$OpenBSD: patch-gio_gunixmount_c,v 1.6 2012/09/21 13:16:49 ajacoutot Exp $

https://bugzilla.gnome.org/show_bug.cgi?id=653555

--- gio/gunixmount.c.orig	Wed Sep  5 02:49:08 2012
+++ gio/gunixmount.c	Thu Sep 20 10:59:23 2012
@@ -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"
@@ -462,10 +468,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);
 }
