summaryrefslogtreecommitdiff
path: root/src/c99-to-c89.diff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-09-22 10:02:09 +0200
committerJim Meyering <jim@meyering.net>2007-09-22 13:27:57 +0200
commita7ec8caffe1a48590f5e3da9400080ab8a6ec303 (patch)
tree2f60406ee7f34139c53def242c7bf89005074761 /src/c99-to-c89.diff
parent920b4416c147ecb76731137158da8bcc9041fecd (diff)
downloadcoreutils-a7ec8caffe1a48590f5e3da9400080ab8a6ec303.tar.xz
rm: give a sensible diagnostic when failing to remove a symlink
On some systems (those with openat et al), when rm would fail to remove a symlink, it would fail with the misleading diagnostic, "Too many levels of symbolic links". * NEWS: Mention the bug fix. * src/remove.c (is_nondir_lstat): New function. (remove_entry): Use it to catch failed-to-remove symlink (and any other non-dir) here so that we don't fall through and try to treat it as directory, which -- with a symlink -- would provoke the bogus ELOOP failure. * tests/rm/fail-eacces: Add a test for the above. * src/c99-to-c89.diff: Adjust offsets.
Diffstat (limited to 'src/c99-to-c89.diff')
-rw-r--r--src/c99-to-c89.diff6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/c99-to-c89.diff b/src/c99-to-c89.diff
index 3e66bc480..01e213beb 100644
--- a/src/c99-to-c89.diff
+++ b/src/c99-to-c89.diff
@@ -42,7 +42,7 @@ diff -upr src/remove.c src/remove.c
if (!yesno ())
return RM_USER_DECLINED;
-@@ -1515,6 +1519,7 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1533,6 +1537,7 @@ rm_1 (Dirstack_state *ds, char const *fi
return RM_ERROR;
}
@@ -50,7 +50,7 @@ diff -upr src/remove.c src/remove.c
struct stat st;
cache_stat_init (&st);
cycle_check_init (&ds->cycle_check_state);
-@@ -1537,6 +1542,7 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1555,6 +1560,7 @@ rm_1 (Dirstack_state *ds, char const *fi
AD_push_initial (ds);
AD_INIT_OTHER_MEMBERS ();
@@ -58,7 +58,7 @@ diff -upr src/remove.c src/remove.c
enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
DT_UNKNOWN, &st, x);
if (status == RM_NONEMPTY_DIR)
-@@ -1555,6 +1561,8 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1573,6 +1579,8 @@ rm_1 (Dirstack_state *ds, char const *fi
ds_clear (ds);
return status;
}