Fix lstat() for broken junction points on Windows.
authorThomas Munro <tmunro@postgresql.org>
Tue, 25 Oct 2022 02:20:00 +0000 (15:20 +1300)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 7 Nov 2024 23:16:39 +0000 (09:46 +1030)
commitbb509a464e3e59e13b8869665fe5eccc98f83b39
tree2dbef2798d96e02d539f6b10b9b163b243857e9a
parentee219102d2e76d3e7277ac1a7ddda7757737b31b
Fix lstat() for broken junction points on Windows.

When using junction points to emulate symlinks on Windows, one edge case
was not handled correctly by commit c5cb8f3b: if a junction point is
broken (pointing to a non-existent path), we'd report ENOENT.  This
doesn't break any known use case, but was noticed while developing a
test suite for these functions and is fixed here for completeness.

Also add translation ERROR_CANT_RESOLVE_FILENAME -> ENOENT, as that is
one of the errors Windows can report for some kinds of broken paths.

Discussion: https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com
(cherry picked from commit 387803d81d6256fcb60b9192bb5b00042442b4e3)

Author: Thomas Munro <tmunro@postgresql.org>
Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
src/port/win32error.c
src/port/win32stat.c