$OpenBSD: patch-modules_file-method_c,v 1.1 2008/06/28 11:42:27 jasper Exp $
--- modules/file-method.c.orig	Sat Jun 28 13:25:57 2008
+++ modules/file-method.c	Sat Jun 28 13:30:46 2008
@@ -2377,7 +2377,18 @@ do_set_file_info (GnomeVFSMethod *method,
 	}
 
 	if (mask & GNOME_VFS_SET_FILE_INFO_PERMISSIONS) {
-		if (chmod (full_name, info->permissions) != 0) {
+		int tmask;
+		int permissions = info->permissions;
+		/*
+		 * ktrace showed "invalid argument", and this makes sense....
+		 * because, we cannot pass the GNOME_VFS_PERM_ACCESS_*
+		 * constants to chmod.
+		 */
+		tmask = GNOME_VFS_PERM_ACCESS_READABLE;
+		tmask |= GNOME_VFS_PERM_ACCESS_WRITABLE;
+		tmask |= GNOME_VFS_PERM_ACCESS_EXECUTABLE;
+		permissions = permissions & ~tmask;
+		if (chmod (full_name, permissions) != 0) {
 			g_free (full_name);
 			return gnome_vfs_result_from_errno ();
 		}
