fix recursive rm to delete broken symlinks

SVN revision: 26609
This commit is contained in:
Carsten Haitzler 2006-10-15 09:18:26 +00:00
parent 88ce3a9252
commit 6abe8fae09
1 changed files with 2 additions and 3 deletions

View File

@ -112,16 +112,14 @@ ecore_file_recursive_rm(const char *dir)
struct stat st; struct stat st;
if (stat(dir, &st) == -1) return 0;
if (readlink(dir, buf, sizeof(buf)) > 0) if (readlink(dir, buf, sizeof(buf)) > 0)
{ {
ecore_file_unlink(dir); ecore_file_unlink(dir);
} }
else if (S_ISDIR(st.st_mode)) else if (S_ISDIR(st.st_mode))
{ {
if (stat(dir, &st) == -1) return 0;
dirp = opendir(dir); dirp = opendir(dir);
if (dirp) if (dirp)
{ {
while ((dp = readdir(dirp))) while ((dp = readdir(dirp)))
@ -138,6 +136,7 @@ ecore_file_recursive_rm(const char *dir)
} }
else else
{ {
if (stat(dir, &st) == -1) return 0;
ecore_file_unlink(dir); ecore_file_unlink(dir);
} }