chmod.c: mask out the file type bits.

The kernel will do this for us on both Linux and macOS, but error
messages are a bit misleading if we don't do it ourselves --- it
can look as if the failure is because of the type bits.
This commit is contained in:
Elliott Hughes 2020-12-15 10:53:09 -08:00 committed by Rob Landley
parent 83326334d5
commit fbc2252f4f

View File

@ -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);
mode = string_to_mode(TT.mode, try->st.st_mode & ~S_IFMT);
if (FLAG(v)) {
char *s = dirtree_path(try, 0);