Stat the XML file before trying to parse it to make sure it exists.

2003-05-30  Jeffrey Stedfast  <fejj@ximian.com>

	* mail-local.c (load_metainfo): Stat the XML file before trying to
	parse it to make sure it exists.

svn path=/trunk/; revision=21368
This commit is contained in:
Jeffrey Stedfast
2003-06-02 17:27:27 +00:00
committed by Jeffrey Stedfast
parent 1e93138b54
commit 3bf07b8693
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-05-30 Jeffrey Stedfast <fejj@ximian.com>
* mail-local.c (load_metainfo): Stat the XML file before trying to
parse it to make sure it exists.
2003-05-29 Not Zed <NotZed@Ximian.com> 2003-05-29 Not Zed <NotZed@Ximian.com>
* Makefile.am (BUILT_SOURCES): added server_DATA (*.server) so * Makefile.am (BUILT_SOURCES): added server_DATA (*.server) so

View File

@ -136,15 +136,19 @@ static CamelType mail_local_folder_get_type (void);
static struct _local_meta * static struct _local_meta *
load_metainfo(const char *path) load_metainfo(const char *path)
{ {
xmlDocPtr doc; xmlDocPtr doc = NULL;
xmlNodePtr node; xmlNodePtr node;
struct _local_meta *meta; struct _local_meta *meta;
struct stat st;
d(printf("Loading folder metainfo from : %s\n", path)); d(printf("Loading folder metainfo from : %s\n", path));
meta = g_malloc0(sizeof(*meta)); meta = g_malloc0(sizeof(*meta));
meta->path = g_strdup(path); meta->path = g_strdup(path);
if (stat (path, &st) == -1 || !S_ISREG (st.st_mode))
goto dodefault;
doc = xmlParseFile(path); doc = xmlParseFile(path);
if (doc == NULL) if (doc == NULL)
goto dodefault; goto dodefault;