[patch] fix mkdir(NULL) in gnome_metadata
- From: Darin Adler <darin bentspoon com>
- To: gnome-devel-list gnome org
- Cc: miguel ximian com
- Subject: [patch] fix mkdir(NULL) in gnome_metadata
- Date: Thu, 30 Aug 2001 18:02:05 -0700
This patch fixes a problem where the metadata code could
run code that assumes init is called before calling init.
There still may be problems in other cases if init fails.
This was causing "mkdir(NULL)" in Nautilus.
Can I commit this fix?
Index: libgnome/gnome-metadata.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnome/Attic/gnome-metadata.c,v
retrieving revision 1.47.4.1
diff -p -u -r1.47.4.1 gnome-metadata.c
--- libgnome/gnome-metadata.c 1999/12/15 04:49:59 1.47.4.1
+++ libgnome/gnome-metadata.c 2001/08/31 00:50:00
@@ -1158,9 +1158,13 @@ gnome_metadata_get (const char *file, co
{
int r;
G_LOCK (database_mu);
- lock ();
- r = get_worker (file, name, size, buffer, 0);
- unlock ();
+ if (! database () && init ())
+ r = GNOME_METADATA_IO_ERROR;
+ else {
+ lock ();
+ r = get_worker (file, name, size, buffer, 0);
+ unlock ();
+ }
G_UNLOCK (database_mu);
return r;
}
@@ -1184,9 +1188,13 @@ gnome_metadata_get_fast (const char *fil
{
int r;
G_LOCK (database_mu);
- lock ();
- r = get_worker (file, name, size, buffer, 1);
- unlock ();
+ if (! database () && init ())
+ r = GNOME_METADATA_IO_ERROR;
+ else {
+ lock ();
+ r = get_worker (file, name, size, buffer, 1);
+ unlock ();
+ }
G_UNLOCK (database_mu);
return r;
}
===================================================================
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]