Fix garbled symlink target

This commit is contained in:
Arun Prakash Jana 2021-03-19 00:27:45 +05:30
parent 5f0b3b74d0
commit 4c8e2e25b8
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 8 additions and 4 deletions

View File

@ -5687,11 +5687,15 @@ static void statusbar(char *path)
addstr(coolsize(pent->size)); addstr(coolsize(pent->size));
addch(' '); addch(' ');
addstr(ptr); addstr(ptr);
if (S_ISLNK(pent->mode) && (readlink(pent->name, g_buf, PATH_MAX) > 0)) if (S_ISLNK(pent->mode))
{ {
addstr(" [-> "); i = readlink(pent->name, g_buf, PATH_MAX);
addstr(g_buf); if (i > 1) {
addch(']'); g_buf[i] = '\0';
addstr(" [-> ");
addstr(g_buf);
addch(']');
}
} }
addch('\n'); addch('\n');
} }