If the response is not affirmative, the file is skipped.
Any attempt to remove a file whose last file name component is
-@file{.} or @file{..} is rejected without any prompting.
+@file{.} or @file{..} is rejected without any prompting, as mandated
+by POSIX.
@emph{Warning}: If you use @command{rm} to remove a file, it is usually
possible to recover the contents of that file. If you want more assurance
/* Perform checks that can apply only for command-line arguments. */
if (ent->fts_level == FTS_ROOTLEVEL)
{
- /* If the basename of a command line argument is "." or "..",
+ /* POSIX says:
+ If the basename of a command line argument is "." or "..",
diagnose it and do nothing more with that argument. */
if (dot_or_dotdot (last_component (ent->fts_accpath)))
{
- error (0, 0, _("cannot remove directory: %s"),
- quote (ent->fts_path));
+ error (0, 0,
+ _("refusing to remove %s or %s directory: skipping %s"),
+ quote_n (0, "."), quote_n (1, ".."),
+ quote_n (2, ent->fts_path));
fts_skip_tree (fts, ent);
return RM_ERROR;
}
- /* If a command line argument resolves to "/" (and --preserve-root
+ /* POSIX also says:
+ If a command line argument resolves to "/" (and --preserve-root
is in effect -- default) diagnose and skip it. */
if (ROOT_DEV_INO_CHECK (x->root_dev_ino, ent->fts_statp))
{