diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2026-01-09 20:05:14 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-09 18:32:55 -0800 |
| commit | 2cba5746c03f85fedd45a08b4f91921c5960bb36 (patch) | |
| tree | 884e6c76a3e3ae6b87b797b823f6537ef732f96c /contrib/persistent-https | |
| parent | mingw: try to create symlinks without elevated permissions (diff) | |
| download | git-2cba5746c03f85fedd45a08b4f91921c5960bb36.tar.gz git-2cba5746c03f85fedd45a08b4f91921c5960bb36.zip | |
mingw: emulate `stat()` a little more faithfully
When creating directories via `safe_create_leading_directories()`, we
might encounter an already-existing directory which is not
readable by the current user. To handle that situation, Git's code calls
`stat()` to determine whether we're looking at a directory.
In such a case, `CreateFile()` will fail, though, no matter what, and
consequently `mingw_stat()` will fail, too. But POSIX semantics seem to
still allow `stat()` to go forward.
So let's call `mingw_lstat()` to the rescue if we fail to get a file
handle due to denied permission in `mingw_stat()`, and fill the stat
info that way.
We need to be careful to not allow this to go forward in case that we're
looking at a symbolic link: to resolve the link, we would still have to
create a file handle, and we just found out that we cannot. Therefore,
`stat()` still needs to fail with `EACCES` in that case.
This fixes https://github.com/git-for-windows/git/issues/2531.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
