We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8305398 commit cff3f1eCopy full SHA for cff3f1e
library/std/src/sys/unix/fs.rs
@@ -1647,8 +1647,9 @@ mod remove_dir_impl {
1647
fn remove_dir_all_recursive(parent_fd: Option<RawFd>, path: &CStr) -> io::Result<()> {
1648
// try opening as directory
1649
let fd = match openat_nofollow_dironly(parent_fd, &path) {
1650
- Err(err) if err.raw_os_error() == Some(libc::ENOTDIR) => {
+ Err(err) if matches!(err.raw_os_error(), Some(libc::ENOTDIR | libc::ELOOP)) => {
1651
// not a directory - don't traverse further
1652
+ // (for symlinks, older Linux kernels may return ELOOP instead of ENOTDIR)
1653
return match parent_fd {
1654
// unlink...
1655
Some(parent_fd) => {
0 commit comments