Commit 94c3fded authored by Leah Neukirchen's avatar Leah Neukirchen

recurse: need special case for "lr /"

parent 868aef09
......@@ -1814,6 +1814,7 @@ recurse(char *path, struct history *h)
const char *fpath = *path ? path : ".";
int resolve = Lflag || (Hflag && !h);
int root = (path[0] == '/' && path[1] == 0);
if (resolve ? stat(fpath, &st) : lstat(fpath, &st) < 0) {
if (resolve && errno == ENOENT && !lstat(fpath, &st)) {
......@@ -1870,7 +1871,7 @@ recurse(char *path, struct history *h)
closedir(d);
return -1;
}
if (j > 0) {
if (j > 0 || root) {
path[j] = '/';
strcpy(path + j + 1, de->d_name);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment