summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-06-15 18:04:45 +0200
committerAki <please@ignore.pl>2022-06-15 18:04:45 +0200
commit59506e56f3c1a1d95e0d465cb43d466c5e7ba49e (patch)
tree69055c0ba1b698210bb28f9dc3c37655433af8e5
parentb810fa6ab1d9d3fd7f6ac0b56a1e0e83a5c33b02 (diff)
downloadcoreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.zip
coreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.tar.gz
coreutils-59506e56f3c1a1d95e0d465cb43d466c5e7ba49e.tar.bz2
Tweaked parent directory condition
-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;
}