From c6c4d95cb823d0f24ed36f37f021e6b89c6e2fd8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 10 Jun 2003 20:44:25 +0000 Subject: Stat the file to make sure it exists before trying to parse it using 2003-05-30 Jeffrey Stedfast * e-meta.c (meta_load): Stat the file to make sure it exists before trying to parse it using xmlParseFile(). svn path=/trunk/; revision=21394 --- e-util/ChangeLog | 6 +++--- e-util/e-meta.c | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 6ada021542..8a7bdf962b 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,5 +1,5 @@ -2003-06-04 Rodrigo Moya +2003-05-30 Jeffrey Stedfast - * e-component-listener.[ch]: use ORBit_small_listen/_unlisten instead - of Bonobo_Unknown_ping'ing the components. + * e-meta.c (meta_load): Stat the file to make sure it exists + before trying to parse it using xmlParseFile(). diff --git a/e-util/e-meta.c b/e-util/e-meta.c index 2b0dce5c30..a4c0ad562b 100644 --- a/e-util/e-meta.c +++ b/e-util/e-meta.c @@ -107,10 +107,14 @@ static int meta_load(EMeta *em) { struct _EMetaPrivate *p = em->priv; struct _meta_data *tail, *md; - xmlDocPtr doc; + xmlDocPtr doc = NULL; xmlNodePtr root, work; char *name, *val; - + struct stat st; + + if (stat (p->path, &st) == -1 || !S_ISREG (st.st_mode)) + return -1; + doc = xmlParseFile(p->path); if (doc == NULL) return -1; -- cgit