Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account for realpath failure and update link #1406

Merged
merged 2 commits into from
Jun 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
account for realpath failure
realpath may fail, in which case fallback to mkpath.
  • Loading branch information
N-R-K committed Jun 20, 2022
commit eb66cb5d112ce1e982b7725ea9ae2be2bed126b5
10 changes: 4 additions & 6 deletions src/nnn.c
Original file line number Diff line number Diff line change
Expand Up @@ -6913,13 +6913,11 @@ static bool browse(char *ipath, const char *session, int pkey)
}

pent = &pdents[cur];
if (g_state.selbm) {
S_ISLNK(pent->mode)
? (realpath(pent->name, newpath) && xstrsncpy(path, lastdir, PATH_MAX))
: mkpath(path, pent->name, newpath);
g_state.selbm = 0;
} else
if (!g_state.selbm || !(S_ISLNK(pent->mode) &&
realpath(pent->name, newpath) &&
xstrsncpy(path, lastdir, PATH_MAX)))
mkpath(path, pent->name, newpath);
g_state.selbm = 0;
DPRINTF_S(newpath);

/* Visit directory */
Expand Down