$OpenBSD: patch-modules_file-method_c,v 1.2 2009/10/09 17:39:38 ajacoutot Exp $
--- modules/file-method.c.orig	Mon May 25 10:37:05 2009
+++ modules/file-method.c	Thu Oct  8 17:05:14 2009
@@ -2378,7 +2378,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 ();
 		}
