1
Fork 0

Rollup merge of #134649 - SUPERCILEX:statx-remember, r=thomcc

Fix forgetting to save statx availability on success

Looks like we forgot to save the statx state on success which means the first failure (common when checking if a file exists) will always require spending an invalid statx to confirm the failure is real.

r? `@thomcc`
This commit is contained in:
Jacob Pratt 2024-12-26 21:56:49 -05:00 committed by GitHub
commit 0521d6cf2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,7 +168,8 @@ cfg_has_statx! {{
) -> c_int ) -> c_int
} }
if STATX_SAVED_STATE.load(Ordering::Relaxed) == STATX_STATE::Unavailable as u8 { let statx_availability = STATX_SAVED_STATE.load(Ordering::Relaxed);
if statx_availability == STATX_STATE::Unavailable as u8 {
return None; return None;
} }
@ -200,6 +201,9 @@ cfg_has_statx! {{
return None; return None;
} }
} }
if statx_availability == STATX_STATE::Unknown as u8 {
STATX_SAVED_STATE.store(STATX_STATE::Present as u8, Ordering::Relaxed);
}
// We cannot fill `stat64` exhaustively because of private padding fields. // We cannot fill `stat64` exhaustively because of private padding fields.
let mut stat: stat64 = mem::zeroed(); let mut stat: stat64 = mem::zeroed();