aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/chmod.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/toys/posix/chmod.c b/toys/posix/chmod.c
index 42924399..ac53957c 100644
--- a/toys/posix/chmod.c
+++ b/toys/posix/chmod.c
@@ -4,7 +4,7 @@
*
* See http://opengroup.org/onlinepubs/9699919799/utilities/chmod.html
-USE_CHMOD(NEWTOY(chmod, "<2?vRf[-vf]", TOYFLAG_BIN))
+USE_CHMOD(NEWTOY(chmod, "<2?vfR[-vf]", TOYFLAG_BIN))
config CHMOD
bool "chmod"
@@ -46,14 +46,15 @@ static int do_chmod(struct dirtree *try)
if (!dirtree_notdotdot(try)) return 0;
mode = string_to_mode(TT.mode, try->st.st_mode);
- if (toys.optflags & FLAG_v) {
+ if (FLAG(v)) {
char *s = dirtree_path(try, 0);
- printf("chmod '%s' to %04o\n", s, mode);
+
+ printf("chmod '%s' to %s\n", s, TT.mode);
free(s);
}
wfchmodat(dirtree_parentfd(try), try->name, mode);
- return (toys.optflags & FLAG_R) ? DIRTREE_RECURSE : 0;
+ return FLAG(R)*DIRTREE_RECURSE;
}
void chmod_main(void)