Skip to content

Commit fb6e740

Browse files
authored
Merge pull request #1658 from N-R-K/chmod_fix
fix: properly update mode after xchmod
2 parents 4149a26 + b2b830e commit fb6e740

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nnn.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4604,12 +4604,12 @@ static bool show_stats(char *fpath)
46044604
return TRUE;
46054605
}
46064606

4607-
static bool xchmod(const char *fpath, mode_t mode)
4607+
static bool xchmod(const char *fpath, mode_t *mode)
46084608
{
46094609
/* (Un)set (S_IXUSR | S_IXGRP | S_IXOTH) */
4610-
(0100 & mode) ? (mode &= ~0111) : (mode |= 0111);
4610+
(0100 & *mode) ? (*mode &= ~0111) : (*mode |= 0111);
46114611

4612-
return (chmod(fpath, mode) == 0);
4612+
return (chmod(fpath, *mode) == 0);
46134613
}
46144614

46154615
static size_t get_fs_info(const char *path, uchar_t type)
@@ -7381,13 +7381,13 @@ static bool browse(char *ipath, const char *session, int pkey)
73817381

73827382
if ((sel == SEL_STATS && !show_stats(newpath))
73837383
|| (lstat(newpath, &sb) == -1)
7384-
|| (sel == SEL_CHMODX && !xchmod(newpath, sb.st_mode))) {
7384+
|| (sel == SEL_CHMODX && !xchmod(newpath, &sb.st_mode))) {
73857385
printwarn(&presel);
73867386
goto nochange;
73877387
}
73887388

73897389
if (sel == SEL_CHMODX)
7390-
pdents[cur].mode ^= 0111;
7390+
pdents[cur].mode = sb.st_mode;
73917391
}
73927392
break;
73937393
case SEL_REDRAW: // fallthrough

0 commit comments

Comments
 (0)