[evolution-patches] partial fix for bug #43159 (gal-view)



Same fix as I have committed to another function in gal-view already.
After this fix, all the xmlParseFile usages in gal-view are fixed to
stat the file before trying to parse it.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? gal-warnings.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/menus/ChangeLog,v
retrieving revision 1.64
diff -u -r1.64 ChangeLog
--- ChangeLog	24 Apr 2003 16:46:50 -0000	1.64
+++ ChangeLog	16 May 2003 18:07:28 -0000
@@ -1,3 +1,9 @@
+2003-05-16  Jeffrey Stedfast  <fejj ximian com>
+
+	* gal-view-collection.c (load_single_dir): Make sure the
+	galview.xml file exists before trying to parse it with
+	xmlParseFile() to avoid warning spewage from libxml2.
+
 2003-04-23  Jeffrey Stedfast  <fejj ximian com>
 
 	* gal-view-instance.c (load_current_view): Try stat'ing the file
Index: gal-view-collection.c
===================================================================
RCS file: /cvs/gnome/gal/gal/menus/gal-view-collection.c,v
retrieving revision 1.26
diff -u -r1.26 gal-view-collection.c
--- gal-view-collection.c	21 Mar 2003 17:32:04 -0000	1.26
+++ gal-view-collection.c	16 May 2003 18:07:28 -0000
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <util/e-i18n.h>
+#include <sys/stat.h>
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
@@ -384,13 +385,16 @@
 		 char *dir,
 		 gboolean local)
 {
-	xmlDoc *doc;
+	xmlDoc *doc = NULL;
 	xmlNode *root;
 	xmlNode *child;
 	char *filename = g_concat_dir_and_file(dir, "galview.xml");
 	char *default_view;
-
-	doc = xmlParseFile(filename);
+	struct stat st;
+	
+	if (stat (filename, &st) != -1 && S_ISREG (st.st_mode))
+		doc = xmlParseFile (filename);
+	
 	if (!doc) {
 		g_free (filename);
 		return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]