Skip to content

Commit 2348dc5

Browse files
authored
Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
Remove unnecessary stat64 pointer casts In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2 parents 932db19 + 490f49f commit 2348dc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/sys/unix/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
803803
let p = cstr(p)?;
804804
let mut stat: stat64 = unsafe { mem::zeroed() };
805805
cvt(unsafe {
806-
stat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
806+
stat64(p.as_ptr(), &mut stat)
807807
})?;
808808
Ok(FileAttr { stat: stat })
809809
}
@@ -812,7 +812,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
812812
let p = cstr(p)?;
813813
let mut stat: stat64 = unsafe { mem::zeroed() };
814814
cvt(unsafe {
815-
lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
815+
lstat64(p.as_ptr(), &mut stat)
816816
})?;
817817
Ok(FileAttr { stat: stat })
818818
}

0 commit comments

Comments
 (0)