Skip to content

Commit

Permalink
Skip inaccessible directories
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvit committed Sep 28, 2011
1 parent 830ec7a commit 4c50a6d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions find-fsevents-bugs.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ void walk(const char *dir_name, int depth) {
}

dirp = opendir(path_buf);
while ((dirent = readdir(dirp)) != NULL) {
if (0 == strcmp(dirent->d_name, ".") || 0 == strcmp(dirent->d_name, ".."))
continue;
// printf("%s\n", dirent->d_name);
if (dirent->d_type == DT_DIR && depth < 100) {
walk(dirent->d_name, depth + 1);
if (dirp) {
while ((dirent = readdir(dirp)) != NULL) {
if (0 == strcmp(dirent->d_name, ".") || 0 == strcmp(dirent->d_name, ".."))
continue;
// printf("%s\n", dirent->d_name);
if (dirent->d_type == DT_DIR && depth < 100) {
walk(dirent->d_name, depth + 1);
}
}
closedir(dirp);
}
closedir(dirp);

path_end = path_end_saved;
*path_end = 0;
Expand Down

0 comments on commit 4c50a6d

Please sign in to comment.