From e63c9967423b5b9c6fc48d2b31a04e3c030bc16a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 15 Mar 2021 17:08:58 -0700 Subject: chmod: fix +X. I broke this when I added the masking out of the S_IFMT bits for macOS, because string_to_mode needs the full mode with those extra bits, specifically so that it can recognize directories for +X to work. I've duplicated chtest rather than change chtest to explicitly set the modes to 000 before running the given chmod command because I didn't want to touch *all* the tests and obscure the addition of just one. --- toys/posix/chmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys/posix') diff --git a/toys/posix/chmod.c b/toys/posix/chmod.c index 2cdda951..ef74c4fa 100644 --- a/toys/posix/chmod.c +++ b/toys/posix/chmod.c @@ -50,7 +50,7 @@ static int do_chmod(struct dirtree *try) // symlinks mentioned directly as arguments. We'll fail, of course, // but that's what you asked for in that case. } else { - mode = string_to_mode(TT.mode, try->st.st_mode & ~S_IFMT); + mode = string_to_mode(TT.mode, try->st.st_mode) & ~S_IFMT; if (FLAG(v)) { char *s = dirtree_path(try, 0); -- cgit v1.2.3