- if (entry->d_type == DT_LNK) {
- safe_strncpy(name + baseofs, entry->d_name, 10);
- fdlink = xmalloc_readlink(name);
+ /* Skip entries '.' and '..' (and any hidden file) */
+ if (entry->d_name[0] == '.')
+ continue;
+
+ safe_strncpy(name + baseofs, entry->d_name, 10);
+ if ((fdlink = xmalloc_readlink(name)) != NULL) {