summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/chmod.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/chmod.c b/src/chmod.c
index 2e2cbaad1..6e6bd903c 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -137,6 +137,8 @@ change_file_mode (const char *file, const struct mode_change *changes,
struct stat file_stats;
mode_t newmode;
int errors = 0;
+ int fail;
+ int saved_errno;
if (lstat (file, &file_stats))
{
@@ -161,24 +163,19 @@ change_file_mode (const char *file, const struct mode_change *changes,
newmode = mode_adjust (file_stats.st_mode, changes);
- if (newmode != (file_stats.st_mode & CHMOD_MODE_BITS))
- {
- int fail = chmod (file, newmode);
- int saved_errno = errno;
+ fail = chmod (file, newmode);
+ saved_errno = errno;
- if (verbosity == V_high || (verbosity == V_changes_only && !fail))
- describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
+ if (verbosity == V_high || (verbosity == V_changes_only && !fail))
+ describe_change (file, newmode, (fail ? CH_FAILED : CH_SUCCEEDED));
- if (fail)
- {
- if (force_silent == 0)
- error (0, saved_errno, _("changing permissions of %s"),
- quote (file));
- errors = 1;
- }
+ if (fail)
+ {
+ if (force_silent == 0)
+ error (0, saved_errno, _("changing permissions of %s"),
+ quote (file));
+ errors = 1;
}
- else if (verbosity == V_high)
- describe_change (file, newmode, CH_NO_CHANGE_REQUESTED);
if (recurse && S_ISDIR (file_stats.st_mode))
errors |= change_dir_mode (file, changes, &file_stats);