Skip to content

Commit 5d43472

Browse files
lchioccaGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
The stat() function should be independent of core.symlinks
The contract for the stat() and lstat() function is: > stat(): stats the file pointed to by path and fills in buf. > lstat(): is identical to stat(), except that if path is a symbolic link, > then the link itself is stat-ed, not the file that it refers to. stat() should always return the statistics of the file or directory a symbolic link is pointing to. The lstat() function is used to get the stats for the symlink. Hence the check should not be there. Signed-off-by: Loris Chiocca <[email protected]>
1 parent f37c64a commit 5d43472

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

compat/mingw.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -914,17 +914,7 @@ int mingw_stat(const char *file_name, struct stat *buf)
914914
HANDLE hnd;
915915
int result;
916916

917-
/* if symlinks are disabled, use lstat() (without following links) */
918-
if (!has_symlinks) {
919-
result = lstat(file_name, buf);
920-
if (!result && S_ISLNK(buf->st_mode)) {
921-
errno = ELOOP;
922-
return -1;
923-
}
924-
return result;
925-
}
926-
927-
/* otherwise just open the file and let Windows resolve the links */
917+
/* open the file and let Windows resolve the links */
928918
if (xutftowcs_long_path(wfile_name, file_name) < 0)
929919
return -1;
930920
hnd = CreateFileW(wfile_name, 0,

0 commit comments

Comments
 (0)