account for realpath failure

realpath may fail, in which case fallback to mkpath.
This commit is contained in:
NRK 2022-06-20 21:49:41 +06:00
parent 6c197f5f02
commit eb66cb5d11
1 changed files with 4 additions and 6 deletions

View File

@ -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 */