aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-12-15 10:53:09 -0800
committerRob Landley <rob@landley.net>2020-12-16 15:22:58 -0600
commitfbc2252f4f5260d616d6929351aa9cac5d227124 (patch)
treefc4caac584d0fa65f08413c079496f0be70c38a9 /toys/posix
parent83326334d5bda7fefbd174630c23eae3b5f41604 (diff)
downloadtoybox-fbc2252f4f5260d616d6929351aa9cac5d227124.tar.gz
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.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/chmod.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/chmod.c b/toys/posix/chmod.c
index 3838b527..2cdda951 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);
+ mode = string_to_mode(TT.mode, try->st.st_mode & ~S_IFMT);
if (FLAG(v)) {
char *s = dirtree_path(try, 0);