src/nnn.c | 10 +++++----- diff --git a/src/nnn.c b/src/nnn.c index 6bd82d2d2dd81f7fc43544b7f4191a1733bbb69b..592a083a92b31c20d6b0111692d4634b25a8ba34 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4604,12 +4604,12 @@ unlink(g_tmpfpath); return TRUE; } -static bool xchmod(const char *fpath, mode_t mode) +static bool xchmod(const char *fpath, mode_t *mode) { /* (Un)set (S_IXUSR | S_IXGRP | S_IXOTH) */ - (0100 & mode) ? (mode &= ~0111) : (mode |= 0111); + (0100 & *mode) ? (*mode &= ~0111) : (*mode |= 0111); - return (chmod(fpath, mode) == 0); + return (chmod(fpath, *mode) == 0); } static size_t get_fs_info(const char *path, uchar_t type) @@ -7381,13 +7381,13 @@ mkpath(tmp, pdents[cur].name, newpath); if ((sel == SEL_STATS && !show_stats(newpath)) || (lstat(newpath, &sb) == -1) - || (sel == SEL_CHMODX && !xchmod(newpath, sb.st_mode))) { + || (sel == SEL_CHMODX && !xchmod(newpath, &sb.st_mode))) { printwarn(&presel); goto nochange; } if (sel == SEL_CHMODX) - pdents[cur].mode ^= 0111; + pdents[cur].mode = sb.st_mode; } break; case SEL_REDRAW: // fallthrough