mingw: fix st_mode for symlink dirs

When encountering symlinks, do_lstat() currently overwrites
buf->st_mode with S_IFREG if follow is true. This is incorrect
when the symlink points to a directory.

get_file_attr calls GetFileAttributesExA, which follows symlinks
already. So our st_mode should already be correct at this point.

Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
This commit is contained in:
Erik Faye-Lund
2010-03-20 22:48:42 +01:00
committed by Johannes Schindelin
parent acc5880a61
commit c8a1530575

View File

@@ -373,7 +373,6 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
if (follow) {
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
buf->st_size = readlink(file_name, buffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
buf->st_mode = S_IFREG;
} else {
buf->st_mode = S_IFLNK;
}