Skip to content

Commit 2a13f38

Browse files
lchioccaGit for Windows Build Agent
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 7c6a844 commit 2a13f38

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
@@ -791,17 +791,7 @@ int mingw_stat(const char *file_name, struct stat *buf)
791791
HANDLE hnd;
792792
int result;
793793

794-
/* if symlinks are disabled, use lstat() (without following links) */
795-
if (!has_symlinks) {
796-
result = lstat(file_name, buf);
797-
if (!result && S_ISLNK(buf->st_mode)) {
798-
errno = ELOOP;
799-
return -1;
800-
}
801-
return result;
802-
}
803-
804-
/* otherwise just open the file and let Windows resolve the links */
794+
/* open the file and let Windows resolve the links */
805795
if (xutftowcs_long_path(wfile_name, file_name) < 0)
806796
return -1;
807797
hnd = CreateFileW(wfile_name, 0,

0 commit comments

Comments
 (0)