$OpenBSD: patch-gio_gunixmount_c,v 1.2 2010/09/30 07:17:19 ajacoutot Exp $

Removable device needs to be unmounted before it is ejected.

--- gio/gunixmount.c.orig	Mon Aug  9 15:34:46 2010
+++ gio/gunixmount.c	Mon Sep 27 14:42:36 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"
@@ -452,10 +457,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);
 }
