$OpenBSD: patch-gio_gunixmount_c,v 1.13 2015/09/24 10:23:42 ajacoutot Exp $

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

--- gio/gunixmount.c.orig	Wed Aug 19 05:35:30 2015
+++ gio/gunixmount.c	Wed Sep 23 09:25:35 2015
@@ -27,6 +27,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 "gsubprocess.h"
 #include "gioenums.h"
@@ -357,12 +363,20 @@ g_unix_mount_eject (GMount             *mount,
   GUnixMount *unix_mount = G_UNIX_MOUNT (mount);
   char *argv[] = {"eject", NULL, NULL};
 
+#ifndef __OpenBSD__ /* eject(1) requires a device on OpenBSD */
   if (unix_mount->mount_path != NULL)
     argv[1] = unix_mount->mount_path;
   else
+#endif
     argv[1] = unix_mount->device_path;
 
   eject_unmount_do (mount, cancellable, callback, user_data, argv);
+
+/* eject(1) on OpenBSD does not try to unmount first */
+#ifdef __OpenBSD__
+  if (unmount(unix_mount->mount_path, MNT_FORCE) < 0)
+    g_warning ("%s unmount failed: %s\n", unix_mount->mount_path, strerror(errno));
+#endif
 }
 
 static gboolean
