summaryrefslogtreecommitdiff
path: root/ext/fs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fs')
-rw-r--r--ext/fs/std_fs.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs
index 3cbd154d5..d8d5f6502 100644
--- a/ext/fs/std_fs.rs
+++ b/ext/fs/std_fs.rs
@@ -1069,8 +1069,10 @@ fn open_with_access_check(
};
(*access_check)(false, &path, &options)?;
// On Linux, /proc may contain magic links that we don't want to resolve
- let needs_canonicalization = !is_windows_device_path
- && (!cfg!(target_os = "linux") || path.starts_with("/proc"));
+ let is_linux_special_path = cfg!(target_os = "linux")
+ && (path.starts_with("/proc") || path.starts_with("/dev"));
+ let needs_canonicalization =
+ !is_windows_device_path && !is_linux_special_path;
let path = if needs_canonicalization {
match path.canonicalize() {
Ok(path) => path,