summaryrefslogtreecommitdiff
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
parent9c3682b7462a82344b264d6a98d4e1c681588e76 (diff)
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,
146 Eina_Iterator *it; 146 Eina_Iterator *it;
147 Eina_File_Direct_Info *info; 147 Eina_File_Direct_Info *info;
148 struct stat st; 148 struct stat st;
149 int ret = 1;
149 150
150 if (!ecore_file_is_dir(path)) return 1; 151 if (!ecore_file_is_dir(path)) return 1;
151 if (stat(path, &st) == -1) return 1; 152 if (stat(path, &st) == -1) return 1;
@@ -153,11 +154,7 @@ cache_scan(Eina_Inarray *stack, const char *path, const char *base_id,
153 eina_inarray_push(stack, &st); 154 eina_inarray_push(stack, &st);
154 155
155 it = eina_file_stat_ls(path); 156 it = eina_file_stat_ls(path);
156 if (!it) 157 if (!it) goto end;
157 {
158 eina_inarray_pop(stack);
159 return 1;
160 }
161 id[0] = '\0'; 158 id[0] = '\0';
162 EINA_ITERATOR_FOREACH(it, info) 159 EINA_ITERATOR_FOREACH(it, info)
163 { 160 {
@@ -178,22 +175,22 @@ cache_scan(Eina_Inarray *stack, const char *path, const char *base_id,
178 if (((info->type == EINA_FILE_LNK) && (ecore_file_is_dir(info->path))) || 175 if (((info->type == EINA_FILE_LNK) && (ecore_file_is_dir(info->path))) ||
179 (info->type == EINA_FILE_DIR)) 176 (info->type == EINA_FILE_DIR))
180 { 177 {
181 if (recurse) 178 if (recurse)
182 cache_scan(stack, info->path, file_id, priority, recurse, changed); 179 {
180 ret = cache_scan(stack, info->path, file_id, priority, recurse, changed);
181 if (!ret) break;
182 }
183 } 183 }
184 else 184 else
185 { 185 {
186 if (!cache_add(info->path, file_id, priority, changed)) 186 ret = cache_add(info->path, file_id, priority, changed);
187 { 187 if (!ret) break;
188 eina_iterator_free(it);
189 eina_inarray_pop(stack);
190 return 0;
191 }
192 } 188 }
193 } 189 }
194 eina_iterator_free(it); 190 eina_iterator_free(it);
191end:
195 eina_inarray_pop(stack); 192 eina_inarray_pop(stack);
196 return 1; 193 return ret;
197} 194}
198 195
199static int 196static int