summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2017-02-17 10:14:13 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2017-02-17 10:14:13 +0000
commita2865c8a7c86af4aa9de9dc3b85478dbc42aea83 (patch)
treeb457ad0054d1ee9da02b987a5c4c9e48c42a031f /bin
parent77294c67b2d37bb62da7cc880a65dc026c34b84b (diff)
In chmod's symbolic mode without -h and -R flags, a missing FTS_COMFOLLOW
flag to fts_open led to the following behavior: the symlink's permissions were read, changed according to the command line, and transferred to the target file. chflags had a similar problem while chmod was unaffected. Regression introduced in r1.33. Reported by Christopher Wellons, thanks! ok guenther
Diffstat (limited to 'bin')
-rw-r--r--bin/chmod/chmod.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c
index 2ed31346ed9..9e5cd1b0711 100644
--- a/bin/chmod/chmod.c
+++ b/bin/chmod/chmod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chmod.c,v 1.40 2016/10/19 18:20:25 schwarze Exp $ */
+/* $OpenBSD: chmod.c,v 1.41 2017/02/17 10:14:12 tb Exp $ */
/* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */
/*
@@ -146,8 +146,10 @@ done:
fts_options |= FTS_LOGICAL;
atflags = 0;
}
- } else if (!hflag)
+ } else if (!hflag) {
+ fts_options |= FTS_COMFOLLOW;
atflags = 0;
+ }
if (ischflags) {
if (pledge("stdio rpath fattr", NULL) == -1)