diff options
| author | Jani Nikula <jani@nikula.org> | 2017-09-01 18:53:08 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-10-02 07:59:19 -0300 |
| commit | 23819e82d061502fce8d3876f3e606aa56ca6ea0 (patch) | |
| tree | 84d3c3afc155de3e6ef59a7f6d93b5af0ec4de9d | |
| parent | 379de73603d98da6a9cc95a9af914f98bd393e95 (diff) | |
cli/new: check for special directories earlier in pass 1
Avoid passing . and .. to ignore check. We don't need to check their
dirent type either.
| -rw-r--r-- | notmuch-new.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/notmuch-new.c b/notmuch-new.c index faeb8f0a..378bf4c2 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -452,6 +452,10 @@ add_files (notmuch_database_t *notmuch, for (i = 0; i < num_fs_entries && ! interrupted; i++) { entry = fs_entries[i]; + /* Ignore special directories to avoid infinite recursion. */ + if (_special_directory (entry->d_name)) + continue; + /* Ignore any files/directories the user has configured to * ignore. We do this before dirent_type both for performance * and because we don't care if dirent_type fails on entries @@ -477,12 +481,10 @@ add_files (notmuch_database_t *notmuch, continue; } - /* Ignore special directories to avoid infinite recursion. - * Also ignore the .notmuch directory and any "tmp" directory + /* Ignore the .notmuch directory and any "tmp" directory * that appears within a maildir. */ - if (_special_directory (entry->d_name) || - (is_maildir && strcmp (entry->d_name, "tmp") == 0) || + if ((is_maildir && strcmp (entry->d_name, "tmp") == 0) || strcmp (entry->d_name, ".notmuch") == 0) continue; |
