esh: fix globbing of .*

This commit is contained in:
K. Lange 2018-10-30 16:10:49 +09:00
parent e8ec1cb6c3
commit 0282e6281e

View File

@ -1183,7 +1183,7 @@ _done:
if (dirp) {
struct dirent * ent = readdir(dirp);
while (ent != NULL) {
if (ent->d_name[0] != '.') {
if (ent->d_name[0] != '.' || (dir ? (dir[1] == '.') : (before && before[0] == '.'))) {
char * s = malloc(sizeof(char) * (strlen(ent->d_name) + 1));
memcpy(s, ent->d_name, strlen(ent->d_name) + 1);