summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_file/ecore_file.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-10-30 10:44:07 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-10-30 10:44:07 +0000
commit887c2a119056f68a3cf201f5e85215bb49d31a83 (patch)
treefa69b1a4ebdbcad1bac2df211d1aa503e85b1cae /legacy/ecore/src/lib/ecore_file/ecore_file.c
parentda39b6c326a622b8dfa21ce03645af9c89866057 (diff)
remove unnecessary stat calls in recursive_rm, patch by Maxime Villard
this patch didn't come with any changelog/news updates, so I'm assuming it's trivial enough to not need them or any backporting. someone else can take care of that if this is not the case. SVN revision: 78642
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index c59bf8054e..6876511fc6 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file.c
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c
@@ -399,22 +399,27 @@ ecore_file_remove(const char *file)
399EAPI Eina_Bool 399EAPI Eina_Bool
400ecore_file_recursive_rm(const char *dir) 400ecore_file_recursive_rm(const char *dir)
401{ 401{
402 Eina_Iterator *it;
403 char buf[PATH_MAX];
404 struct stat st; 402 struct stat st;
405 int ret; 403
404#ifdef _WIN32
405 char buf[PATH_MAX];
406 406
407 if (readlink(dir, buf, sizeof(buf) - 1) > 0) 407 if (readlink(dir, buf, sizeof(buf) - 1) > 0)
408 return ecore_file_unlink(dir); 408 return ecore_file_unlink(dir);
409 if (stat(dir, &st) == -1)
410 return EINA_FALSE;
411#else
412 if (lstat(dir, &st) == -1)
413 return EINA_FALSE;
414#endif
409 415
410 ret = stat(dir, &st); 416 if (S_ISDIR(st.st_mode))
411 if ((ret == 0) && (S_ISDIR(st.st_mode)))
412 { 417 {
413 Eina_File_Direct_Info *info; 418 Eina_File_Direct_Info *info;
419 Eina_Iterator *it;
420 int ret;
414 421
415 ret = 1; 422 ret = 1;
416 if (stat(dir, &st) == -1) return EINA_FALSE; /* WOOT: WHY ARE WE CALLING STAT TWO TIMES ??? */
417
418 it = eina_file_direct_ls(dir); 423 it = eina_file_direct_ls(dir);
419 EINA_ITERATOR_FOREACH(it, info) 424 EINA_ITERATOR_FOREACH(it, info)
420 { 425 {
@@ -431,7 +436,6 @@ ecore_file_recursive_rm(const char *dir)
431 } 436 }
432 else 437 else
433 { 438 {
434 if (ret == -1) return EINA_FALSE;
435 return ecore_file_unlink(dir); 439 return ecore_file_unlink(dir);
436 } 440 }
437} 441}