From 0d70e588e6624db9ce001d32e9ce1148cfde8085 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 6 Jan 2024 01:40:56 +0300 Subject: [PATCH] library: Fix a symlink test failing on Windows --- library/std/src/fs/tests.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) {