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.
This commit is contained in:
Pietro Albini
2018-06-26 11:35:41 +02:00
committed by GitHub

View File

@@ -803,7 +803,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?; let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() }; let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe { cvt(unsafe {
stat64(p.as_ptr(), &mut stat as *mut _ as *mut _) stat64(p.as_ptr(), &mut stat)
})?; })?;
Ok(FileAttr { stat: stat }) Ok(FileAttr { stat: stat })
} }
@@ -812,7 +812,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
let p = cstr(p)?; let p = cstr(p)?;
let mut stat: stat64 = unsafe { mem::zeroed() }; let mut stat: stat64 = unsafe { mem::zeroed() };
cvt(unsafe { cvt(unsafe {
lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _) lstat64(p.as_ptr(), &mut stat)
})?; })?;
Ok(FileAttr { stat: stat }) Ok(FileAttr { stat: stat })
} }