Fix get_dirent_type() for Windows junction points.
authorThomas Munro <[email protected]>
Fri, 22 Jul 2022 04:57:12 +0000 (16:57 +1200)
committerThomas Munro <[email protected]>
Fri, 22 Jul 2022 04:57:12 +0000 (16:57 +1200)
commit9d3444dcce4d62716edec9c58c1b40be42185e7b
tree9e7176e919fec1b0e083d58efd6747639eaf1b0a
parent44ccdce514c4b3b92c8aca744e9cf7be4580be0b
Fix get_dirent_type() for Windows junction points.

Commit 87e6ed7c8 added code that intended to report Windows "junction
points" as DT_LNK (the same way we report symlinks on Unix).  Windows
junction points are *also* directories according to the Windows
attributes API, and we were reporting them as as DT_DIR.  Change the
order we check the attribute flags, to prioritize DT_LNK.

If at some point we start using Windows' recently added real symlinks
and need to distinguish them from junction points, we may need to
rethink this, but for now this continues the tradition of wrapper
functions that treat junction points as symlinks.

Back-patch to 14, where get_dirent_type() landed.

Reviewed-by: Michael Paquier <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com
Discussion: https://postgr.es/m/20220721111751.x7hod2xgrd76xr5c%40alvherre.pgsql
src/port/dirent.c