Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! mingw: add a cache below mingw's lstat and dirent implementations
Since df3458e (refs API: make parse_loose_ref_contents() not set errno, 2021-10-16), `files_read_raw_ref()` assumes that `errno` is always set to a non-zero value upon failure. It even goes so far as to hard-code that assumption in a `BUG()` when that assumption is not met, rather than fail gracefully. According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html, `lstat()` shall indeed set `errno` upon failure, and https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html indicates that indeed, the code may rely on `errno` being set to a non-zero value upon failure. In `fscache_lstat()`, we did not set `errno` upon a cache miss (which indicates that the item did not exist at the time the `lstat()` values were cached), and therefore we now trigger this problem all the time. Let's set `errno=ENOENT` when no entry was found. This fixes #3674 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Loading branch information