$OpenBSD: patch-gio_gunixmount_c,v 1.14 2016/10/28 13:40:04 ajacoutot Exp $

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

--- gio/gunixmount.c.orig	Fri Jul  1 21:54:29 2016
+++ gio/gunixmount.c	Wed Oct 26 11:37:25 2016
@@ -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"
@@ -358,12 +364,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
