mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 16:45:37 +00:00
Make WASI's hard_link
behavior match other platforms.
Following #78026, `std::fs::hard_link` on most platforms does not follow symlinks. Change the WASI implementation to also not follow symlinks.
This commit is contained in:
parent
e708cbd91c
commit
0060c91cfc
@ -557,8 +557,9 @@ pub fn symlink(original: &Path, link: &Path) -> io::Result<()> {
|
|||||||
pub fn link(original: &Path, link: &Path) -> io::Result<()> {
|
pub fn link(original: &Path, link: &Path) -> io::Result<()> {
|
||||||
let (original, original_file) = open_parent(original)?;
|
let (original, original_file) = open_parent(original)?;
|
||||||
let (link, link_file) = open_parent(link)?;
|
let (link, link_file) = open_parent(link)?;
|
||||||
|
// Pass 0 as the flags argument, meaning don't follow symlinks.
|
||||||
original.link(
|
original.link(
|
||||||
wasi::LOOKUPFLAGS_SYMLINK_FOLLOW,
|
0,
|
||||||
osstr2str(original_file.as_ref())?,
|
osstr2str(original_file.as_ref())?,
|
||||||
&link,
|
&link,
|
||||||
osstr2str(link_file.as_ref())?,
|
osstr2str(link_file.as_ref())?,
|
||||||
|
Loading…
Reference in New Issue
Block a user