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:
commit
0521d6cf2c
1 changed files with 5 additions and 1 deletions
|
@ -168,7 +168,8 @@ cfg_has_statx! {{
|
|||
) -> 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;
|
||||
}
|
||||
|
||||
|
@ -200,6 +201,9 @@ cfg_has_statx! {{
|
|||
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.
|
||||
let mut stat: stat64 = mem::zeroed();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue