aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/directory_scanner.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/directory_scanner.c b/src/directory_scanner.c
index 27627d5..0ae1e31 100644
--- a/src/directory_scanner.c
+++ b/src/directory_scanner.c
@@ -124,7 +124,7 @@ int traverse_directory_tree(const char *starting_point) {
int process_directory(char *path) {
char *fullpath = NULL, *fname_in_path = NULL, *stack_entry = NULL;
char type = 0;
- size_t path_length = 0;
+ size_t path_length = 0, dnamelen = 0;
DIR *dir;
struct dirent *de = NULL;
struct stat stat_res;
@@ -159,8 +159,19 @@ int process_directory(char *path) {
}
while ((de = readdir(dir)) != NULL) {
- if (de->d_name[0] == '.' && option_show_hidden_entries == false)
- continue;
+ /* Current dir . and parent dir .. everywhere,
+ * invisible files on UNIXoid filesystems*/
+ if (de->d_name[0] == '.') {
+ if (option_show_hidden_entries == false) {
+ continue;
+ }
+ dnamelen = strlen(de->d_name);
+
+ if ((dnamelen == 1) ||
+ (dnamelen == 2 && de->d_name[1] == '.')) {
+ continue;
+ }
+ }
sprintf(fname_in_path, "%s", de->d_name);
DBGTRC("DEBUG: fullpath: '%s'\n", fullpath);