aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2013-12-05 12:15:07 +0100
committerSebastian Dransfeld <sd@tango.flipp.net>2013-12-05 12:15:07 +0100
commit4413b3a31190990f95a1188b588a7a91a409adfc (patch)
treeae69f7dac6738b049fbc7f674e0577ec7ab36ccf /src/bin/efreet
parentevas - fix overdraw + too many rects problem found in some expedite tests (diff)
downloadefl-4413b3a31190990f95a1188b588a7a91a409adfc.tar.gz
efreet: propagate scan error to caller
Current code ignored return from recursive calls, so if cache_add failed during recursion, the parent call would still succeed.
Diffstat (limited to 'src/bin/efreet')
-rw-r--r--src/bin/efreet/efreet_desktop_cache_create.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/bin/efreet/efreet_desktop_cache_create.c b/src/bin/efreet/efreet_desktop_cache_create.c
index d67084d467..cbaef0efa1 100644
--- a/src/bin/efreet/efreet_desktop_cache_create.c
+++ b/src/bin/efreet/efreet_desktop_cache_create.c
@@ -146,6 +146,7 @@ cache_scan(Eina_Inarray *stack, const char *path, const char *base_id,
Eina_Iterator *it;
Eina_File_Direct_Info *info;
struct stat st;
+ int ret = 1;
if (!ecore_file_is_dir(path)) return 1;
if (stat(path, &st) == -1) return 1;
@@ -153,11 +154,7 @@ cache_scan(Eina_Inarray *stack, const char *path, const char *base_id,
eina_inarray_push(stack, &st);
it = eina_file_stat_ls(path);
- if (!it)
- {
- eina_inarray_pop(stack);
- return 1;
- }
+ if (!it) goto end;
id[0] = '\0';
EINA_ITERATOR_FOREACH(it, info)
{
@@ -178,22 +175,22 @@ cache_scan(Eina_Inarray *stack, const char *path, const char *base_id,
if (((info->type == EINA_FILE_LNK) && (ecore_file_is_dir(info->path))) ||
(info->type == EINA_FILE_DIR))
{
- if (recurse)
- cache_scan(stack, info->path, file_id, priority, recurse, changed);
+ if (recurse)
+ {
+ ret = cache_scan(stack, info->path, file_id, priority, recurse, changed);
+ if (!ret) break;
+ }
}
else
{
- if (!cache_add(info->path, file_id, priority, changed))
- {
- eina_iterator_free(it);
- eina_inarray_pop(stack);
- return 0;
- }
+ ret = cache_add(info->path, file_id, priority, changed);
+ if (!ret) break;
}
}
eina_iterator_free(it);
+end:
eina_inarray_pop(stack);
- return 1;
+ return ret;
}
static int