summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ls.c b/ls.c
index fe6ae76..ec03782 100644
--- a/ls.c
+++ b/ls.c
@@ -30,7 +30,7 @@ int ls(const char * path, struct options opts)
if (opts.skip_dots && is_dot)
continue;
const unsigned int is_self = is_dot && 0 == entry->d_name[1];
- const unsigned int is_up = is_dot && '.' == entry->d_name[1];
+ const unsigned int is_up = is_dot && '.' == entry->d_name[1] && 0 == entry->d_name[2];
if (opts.skip_self_and_up && (is_self || is_up))
continue;
printf("%s\n", entry->d_name);
@@ -60,7 +60,7 @@ int main(int argc, char * argv[])
int res = 0;
if (optind >= argc)
res |= ls(".", opts);
- for (int i = optind; i < argc; ++i)
+ else for (int i = optind; i < argc; ++i)
res |= ls(argv[i], opts);
return res;
}