From b5b0262df27210a1fa05862dee567fa5daf6043a Mon Sep 17 00:00:00 2001 From: Loris Chiocca Date: Mon, 22 Jun 2015 10:29:43 +0200 Subject: [PATCH] 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 --- compat/mingw.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index d97496d9e9..ea047a4ac8 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -914,17 +914,7 @@ int mingw_stat(const char *file_name, struct stat *buf) HANDLE hnd; int result; - /* if symlinks are disabled, use lstat() (without following links) */ - if (!has_symlinks) { - result = lstat(file_name, buf); - if (!result && S_ISLNK(buf->st_mode)) { - errno = ELOOP; - return -1; - } - return result; - } - - /* otherwise just open the file and let Windows resolve the links */ + /* open the file and let Windows resolve the links */ if (xutftowcs_long_path(wfile_name, file_name) < 0) return -1; hnd = CreateFileW(wfile_name, 0,