diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-16 01:53:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-09-17 00:39:21 +0200 |
commit | 2df4e0a3707ff3b70398177e9e001070e47ca9c5 (patch) | |
tree | a7509505f4f86c8b4c3740b5654f262bc507565e | |
parent | 9fe1548bbfde548d54acaab113656a56ea0ccc72 (diff) | |
download | busybox-w32-2df4e0a3707ff3b70398177e9e001070e47ca9c5.tar.gz busybox-w32-2df4e0a3707ff3b70398177e9e001070e47ca9c5.tar.bz2 busybox-w32-2df4e0a3707ff3b70398177e9e001070e47ca9c5.zip |
chmod: correctly report changed modes
Chmod used to incorrectly report as changed even files for which the
mode did not change. This was caused by extra bits in the st_mode, that
were not present when parsed from passed argument in the form of octal
number.
Patch by Wolf <wolf@wolfsden.cz>.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/chmod.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index e260adab2..8e3e1387e 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -88,7 +88,8 @@ static int FAST_FUNC fileAction(struct recursive_state *state, | |||
88 | 88 | ||
89 | if (chmod(fileName, newmode) == 0) { | 89 | if (chmod(fileName, newmode) == 0) { |
90 | if (OPT_VERBOSE | 90 | if (OPT_VERBOSE |
91 | || (OPT_CHANGED && statbuf->st_mode != newmode) | 91 | || (OPT_CHANGED |
92 | && (statbuf->st_mode & 07777) != (newmode & 07777)) | ||
92 | ) { | 93 | ) { |
93 | printf("mode of '%s' changed to %04o (%s)\n", fileName, | 94 | printf("mode of '%s' changed to %04o (%s)\n", fileName, |
94 | newmode & 07777, bb_mode_string(newmode)+1); | 95 | newmode & 07777, bb_mode_string(newmode)+1); |