Commit 5437f0f
committed
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>1 parent 8084c8c commit 5437f0f
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
| 602 | + | |
602 | 603 | | |
| 604 | + | |
603 | 605 | | |
604 | 606 | | |
605 | 607 | | |
| |||
0 commit comments