Fix ls when -q is not set

Use strdup() unconditionally.
This commit is contained in:
sin 2015-02-18 16:48:07 +00:00
parent d40333e702
commit e635760742

2
ls.c
View File

@ -209,7 +209,7 @@ lsdir(const char *path)
output(&ent); output(&ent);
} else { } else {
ents = erealloc(ents, ++n * sizeof(*ents)); ents = erealloc(ents, ++n * sizeof(*ents));
name = p = emalloc(strlen(d->d_name) + 1); name = p = estrdup(d->d_name);
if (qflag) { if (qflag) {
q = d->d_name; q = d->d_name;
while (*q) { while (*q) {