From c5187c959c6fce4eea6e6e21a4e7bf8148be6c67 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 12 Nov 1999 10:50:01 +0000 Subject: (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. --- src/remove.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/remove.c') 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? ")); -- cgit v1.2.3-54-g00ecf