commit eb66cb5d112ce1e982b7725ea9ae2be2bed126b5
parent 6c197f5f024c9d726de145a19c3fcd66fdb365d1
Author: NRK <nrk@disroot.org>
Date: Mon, 20 Jun 2022 21:49:41 +0600
account for realpath failure
realpath may fail, in which case fallback to mkpath.
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/nnn.c b/src/nnn.c
@@ -6913,13 +6913,11 @@ nochange:
}
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 */