diff options
author | Jim Meyering <jim@meyering.net> | 1999-11-12 10:50:01 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-11-12 10:50:01 +0000 |
commit | c5187c959c6fce4eea6e6e21a4e7bf8148be6c67 (patch) | |
tree | 41d1661e1495cc3fa97e31daf4b4b34ff48dfb13 | |
parent | 7872d7c932d5df59d1eff80e537b05b073c9520e (diff) | |
download | coreutils-c5187c959c6fce4eea6e6e21a4e7bf8148be6c67.tar.xz |
(print_nth_dir): Write one fewer byte so we don't print a trailing slash.
(rm): Fix bugs in (and test, this time) the very-rarely-used code
to warn about directory cycles.
-rw-r--r-- | src/remove.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/remove.c b/src/remove.c index e827ac743..f89c56d43 100644 --- a/src/remove.c +++ b/src/remove.c @@ -156,7 +156,7 @@ print_nth_dir (FILE *stream, unsigned int depth) sum += length[i]; } - fwrite (dir_name, 1, sum, stream); + fwrite (dir_name, 1, sum - 1, stream); } static inline struct active_dir_ent * @@ -816,22 +816,19 @@ rm (struct File_spec *fs, int user_specified_name, const struct rm_options *x) numbers are not that likely, this isn't worth detecting. */ new_ent = make_active_dir_ent (fs->inum, current_depth ()); - if (hash_lookup (active_dir_map, new_ent)) + old_ent = hash_lookup (active_dir_map, new_ent); + if (old_ent) { error (0, 0, _("\ WARNING: Circular directory structure.\n\ This almost certainly means that you have a corrupted file system.\n\ NOTIFY YOUR SYSTEM MANAGER.\n\ The following two directories have the same inode number:\n")); - /* FIXME: test this!! */ - print_nth_dir (stderr, current_depth ()); - fputc ('\n', stderr); print_nth_dir (stderr, old_ent->depth); fputc ('\n', stderr); + fprintf (stderr, "%s\n", full_filename (fs->filename)); fflush (stderr); - free (old_ent); - if (x->interactive) { error (0, 0, _("continue? ")); |