diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 12afdef2669aa..5917bf8df029e 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -936,8 +936,10 @@ fn read_link() { } // Check that readlink works with non-drive paths on Windows. let link = tmpdir.join("link_unc"); - check!(symlink_dir(r"\\localhost\c$\", &link)); - assert_eq!(check!(fs::read_link(&link)), Path::new(r"\\localhost\c$\")); + if got_symlink_permission(&tmpdir) { + check!(symlink_dir(r"\\localhost\c$\", &link)); + assert_eq!(check!(fs::read_link(&link)), Path::new(r"\\localhost\c$\")); + }; } let link = tmpdir.join("link"); if !got_symlink_permission(&tmpdir) {