From 1520ad011980f053b997ede857f63b85b25a04ed Mon Sep 17 00:00:00 2001 From: cedric Date: Fri, 6 May 2011 09:36:24 +0000 Subject: [PATCH] evas: don't try all loader on directory. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@59235 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 6 +++++- src/lib/engines/common/evas_image_load.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 138b93f..ff978b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2011-01-29 Carsten Haitzler (The Rasterman) +6~2011-01-29 Carsten Haitzler (The Rasterman) 1.0.0 release @@ -312,3 +312,7 @@ are possibly faster. I haven't noticed any difference between the two speed-wise, but there probably are in some rare cases. +2011-05-06 Cedric Bail + + * Don't try all image loader when user is pointing them on a directory. + diff --git a/src/lib/engines/common/evas_image_load.c b/src/lib/engines/common/evas_image_load.c index 31b3d01..23b9930 100644 --- a/src/lib/engines/common/evas_image_load.c +++ b/src/lib/engines/common/evas_image_load.c @@ -1,3 +1,7 @@ +#include +#include +#include + #include "evas_common.h" #include "evas_private.h" #include "evas_cs.h" @@ -82,6 +86,7 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie) Evas_Image_Load_Func *evas_image_load_func = NULL; const char *loader = NULL, *end; Evas_Module *em; + struct stat st; unsigned int i; int len, ret = EVAS_LOAD_ERROR_NONE; struct evas_image_foreach_loader_data fdata; @@ -100,6 +105,12 @@ evas_common_load_rgba_image_module_from_file(Image_Entry *ie) } } #endif + if (stat(ie->file, &st) != 0 || S_ISDIR(st.st_mode)) + { + DBG("trying to open directory '%s' !", ie->file); + return EVAS_LOAD_ERROR_DOES_NOT_EXIST; + } + len = strlen(ie->file); end = ie->file + len; for (i = 0; i < (sizeof (loaders) / sizeof(struct ext_loader_s)); i++) -- 2.7.4