Skip to content

Commit c10f0f8

Browse files
lchioccadscho
authored andcommitted
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 91a2352 commit c10f0f8

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
@@ -834,17 +834,7 @@ int mingw_stat(const char *file_name, struct stat *buf)
834834
HANDLE hnd;
835835
int result;
836836

837-
/* if symlinks are disabled, use lstat() (without following links) */
838-
if (!has_symlinks) {
839-
result = lstat(file_name, buf);
840-
if (!result && S_ISLNK(buf->st_mode)) {
841-
errno = ELOOP;
842-
return -1;
843-
}
844-
return result;
845-
}
846-
847-
/* otherwise just open the file and let Windows resolve the links */
837+
/* open the file and let Windows resolve the links */
848838
if (xutftowcs_long_path(wfile_name, file_name) < 0)
849839
return -1;
850840
hnd = CreateFileW(wfile_name, 0,

0 commit comments

Comments
 (0)