[GNOME VFS] race fix?

jacob berkman <[email protected]> 08 Jul 2002 15:05:48 -0400
Newsgroups gmane.comp.gnome.vfs
Organization Ximian, Inc.
Message-ID <1026155175.501.103.camel@localhost>
--=-WlTG/MECkUNtLfTb+jJK
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

is this patch right?

 - jacob

--=-WlTG/MECkUNtLfTb+jJK
Content-Disposition: attachment; filename=gnome-vfs-module.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=gnome-vfs-module.patch; charset=ISO-8859-1

Index: gnome-vfs-method.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-method.c,v
retrieving revision 1.22
diff -u -r1.22 gnome-vfs-method.c
--- gnome-vfs-method.c	4 Sep 2001 22:22:58 -0000	1.22
+++ gnome-vfs-method.c	8 Jul 2002 19:01:41 -0000
@@ -283,14 +283,17 @@
=20
 	G_LOCK (module_hash);
 	module_element =3D g_hash_table_lookup (module_hash, name);
-	G_UNLOCK (module_hash);
=20
-	if (module_element !=3D NULL)
+	if (module_element !=3D NULL) {
+		G_UNLOCK (module_hash);
 		return TRUE;
+	}
=20
 	module_name =3D gnome_vfs_configuration_get_module_path (name, &args);
-	if (module_name =3D=3D NULL)
+	if (module_name =3D=3D NULL) {
+		G_UNLOCK (module_hash);
 		return FALSE;
+	}
=20
 	/* Set the effective UID/GID to the user UID/GID to prevent attacks to
            setuid/setgid executables.  */
@@ -308,15 +311,16 @@
 	seteuid (saved_uid);
 	setegid (saved_gid);
=20
-	if (method =3D=3D NULL && transform =3D=3D NULL)
+	if (method =3D=3D NULL && transform =3D=3D NULL) {
+		G_UNLOCK (module_hash);
 		return FALSE;
+	}
=20
 	module_element =3D g_new (ModuleElement, 1);
 	module_element->name =3D g_strdup (name);
 	module_element->method =3D method;
 	module_element->transform =3D transform;
=20
-	G_LOCK (module_hash);
 	g_hash_table_insert (module_hash, module_element->name, module_element);
 	G_UNLOCK (module_hash);
=20

--=-WlTG/MECkUNtLfTb+jJK--


_______________________________________________
gnome-vfs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gnome-vfs