$OpenBSD: patch-gio_gunixmount_c,v 1.1 2010/04/29 16:38:41 ajacoutot Exp $

Removable device needs to be unmounted before it is ejected.

--- gio/gunixmount.c.orig	Sat Aug 29 04:52:23 2009
+++ gio/gunixmount.c	Thu Apr 29 14:13:50 2010
@@ -29,6 +29,11 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#ifdef __OpenBSD__
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
+
 #include <glib.h>
 #include "gunixvolumemonitor.h"
 #include "gunixmount.h"
@@ -453,10 +458,15 @@ g_unix_mount_eject (GMount             *mount,
   GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
   char *argv[] = {"eject", NULL, NULL};
 
+#ifdef __OpenBSD__
+  if (unmount(unix_mount->mount_path, MNT_FORCE) == 0)
+    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 // __OpenBSD__
 
   eject_unmount_do (mount, cancellable, callback, user_data, argv);
 }
