Skip to content

Commit d6d6327

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 049f64e commit d6d6327

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
@@ -774,17 +774,7 @@ int mingw_stat(const char *file_name, struct stat *buf)
774774
HANDLE hnd;
775775
int result;
776776

777-
/* if symlinks are disabled, use lstat() (without following links) */
778-
if (!has_symlinks) {
779-
result = lstat(file_name, buf);
780-
if (!result && S_ISLNK(buf->st_mode)) {
781-
errno = ELOOP;
782-
return -1;
783-
}
784-
return result;
785-
}
786-
787-
/* otherwise just open the file and let Windows resolve the links */
777+
/* open the file and let Windows resolve the links */
788778
if (xutftowcs_long_path(wfile_name, file_name) < 0)
789779
return -1;
790780
hnd = CreateFileW(wfile_name, 0,

0 commit comments

Comments
 (0)