summaryrefslogtreecommitdiff
path: root/src/chmod.c
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2008-11-27 15:04:10 +0100
committerJim Meyering <meyering@redhat.com>2008-12-03 11:02:45 +0100
commitb8497a3a7af5cacb6348854370b2b0d68fc66695 (patch)
tree2542a0c6f14fbf9e849654ec83075aa0ceb94e86 /src/chmod.c
parentc2e56e0de7d86bdc0f824d758a7efde4d5d7b235 (diff)
downloadcoreutils-b8497a3a7af5cacb6348854370b2b0d68fc66695.tar.xz
chmod, chown, chgrp: honor --silent (-f) once again
* chmod.c (process_file): Make -f suppress fts-related diagnostics. * chown-core.c (change_file_owner): Likewise. Reported via <http://bugzilla.redhat.com/474220>.
Diffstat (limited to 'src/chmod.c')
-rw-r--r--src/chmod.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/chmod.c b/src/chmod.c
index 80fc363aa..8c5cc3e49 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -67,7 +67,7 @@ static mode_t umask_value;
/* If true, change the modes of directories recursively. */
static bool recurse;
-/* If true, force silence (no error messages). */
+/* If true, force silence (suppress most of error messages). */
static bool force_silent;
/* If true, diagnose surprises from naive misuses like "chmod -r file".
@@ -121,7 +121,7 @@ mode_changed (char const *file, mode_t old_mode, mode_t new_mode)
if (stat (file, &new_stats) != 0)
{
- if (!force_silent)
+ if (! force_silent)
error (0, errno, _("getting new attributes of %s"), quote (file));
return false;
}
@@ -203,24 +203,29 @@ process_file (FTS *fts, FTSENT *ent)
fts_set (fts, ent, FTS_AGAIN);
return true;
}
- error (0, ent->fts_errno, _("cannot access %s"), quote (file_full_name));
+ if (! force_silent)
+ error (0, ent->fts_errno, _("cannot access %s"),
+ quote (file_full_name));
ok = false;
break;
case FTS_ERR:
- error (0, ent->fts_errno, _("%s"), quote (file_full_name));
+ if (! force_silent)
+ error (0, ent->fts_errno, _("%s"), quote (file_full_name));
ok = false;
break;
case FTS_DNR:
- error (0, ent->fts_errno, _("cannot read directory %s"),
- quote (file_full_name));
+ if (! force_silent)
+ error (0, ent->fts_errno, _("cannot read directory %s"),
+ quote (file_full_name));
ok = false;
break;
case FTS_SLNONE:
- error (0, 0, _("cannot operate on dangling symlink %s"),
- quote (file_full_name));
+ if (! force_silent)
+ error (0, 0, _("cannot operate on dangling symlink %s"),
+ quote (file_full_name));
ok = false;
default:
@@ -319,7 +324,8 @@ process_files (char **files, int bit_flags)
if (errno != 0)
{
/* FIXME: try to give a better message */
- error (0, errno, _("fts_read failed"));
+ if (! force_silent)
+ error (0, errno, _("fts_read failed"));
ok = false;
}
break;