Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d306ab

Browse files
committed
Fix get_dirent_type() for Windows junction points.
Commit87e6ed7 added code that intended to report Windows "junctionpoints" as DT_LNK (the same way we report symlinks on Unix). Windowsjunction points are *also* directories according to the Windowsattributes API, and we were reporting them as as DT_DIR. Change theorder we check the attribute flags, to prioritize DT_LNK.If at some point we start using Windows' recently added real symlinksand need to distinguish them from junction points, we may need torethink this, but for now this continues the tradition of wrapperfunctions that treat junction points as symlinks.Back-patch to 14, where get_dirent_type() landed.Reviewed-by: Michael Paquier <michael@paquier.xyz>Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.comDiscussion:https://postgr.es/m/20220721111751.x7hod2xgrd76xr5c%40alvherre.pgsql
1 parent63a8c68 commit6d306ab

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/port/dirent.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,17 @@ readdir(DIR *d)
106106
}
107107
strcpy(d->ret.d_name,fd.cFileName);/* Both strings are MAX_PATH long */
108108
d->ret.d_namlen=strlen(d->ret.d_name);
109-
/* The only identified types are: directory, regular file or symbolic link */
110-
if ((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0)
111-
d->ret.d_type=DT_DIR;
112-
/* For reparse points dwReserved0 field will contain the ReparseTag */
113-
elseif ((fd.dwFileAttributes&FILE_ATTRIBUTE_REPARSE_POINT)!=0&&
114-
(fd.dwReserved0==IO_REPARSE_TAG_MOUNT_POINT))
109+
110+
/*
111+
* For reparse points dwReserved0 field will contain the ReparseTag. We
112+
* check this first, because reparse points are also reported as
113+
* directories.
114+
*/
115+
if ((fd.dwFileAttributes&FILE_ATTRIBUTE_REPARSE_POINT)!=0&&
116+
(fd.dwReserved0==IO_REPARSE_TAG_MOUNT_POINT))
115117
d->ret.d_type=DT_LNK;
118+
elseif ((fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0)
119+
d->ret.d_type=DT_DIR;
116120
else
117121
d->ret.d_type=DT_REG;
118122

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp