diff options
-rw-r--r-- | include/mingw.h | 1 | ||||
-rw-r--r-- | win32/mingw.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h index e2d6299b9..c411a8106 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -327,6 +327,7 @@ struct mingw_stat { | |||
327 | struct timespec st_ctim; | 327 | struct timespec st_ctim; |
328 | blksize_t st_blksize; | 328 | blksize_t st_blksize; |
329 | blkcnt_t st_blocks; | 329 | blkcnt_t st_blocks; |
330 | DWORD st_attr; | ||
330 | }; | 331 | }; |
331 | #define st_atime st_atim.tv_sec | 332 | #define st_atime st_atim.tv_sec |
332 | #define st_mtime st_mtim.tv_sec | 333 | #define st_mtime st_mtim.tv_sec |
diff --git a/win32/mingw.c b/win32/mingw.c index 78d662e50..faa9f2b57 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -547,6 +547,7 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) | |||
547 | 547 | ||
548 | /* Get the contents of a symlink, not its target. */ | 548 | /* Get the contents of a symlink, not its target. */ |
549 | buf->st_mode = S_IFLNK|S_IRWXU|S_IRWXG|S_IRWXO; | 549 | buf->st_mode = S_IFLNK|S_IRWXU|S_IRWXG|S_IRWXO; |
550 | buf->st_attr = fdata.dwFileAttributes; | ||
550 | buf->st_size = name ? strlen(name) : 0; /* should use readlink */ | 551 | buf->st_size = name ? strlen(name) : 0; /* should use readlink */ |
551 | buf->st_atim = filetime_to_timespec(&(findbuf.ftLastAccessTime)); | 552 | buf->st_atim = filetime_to_timespec(&(findbuf.ftLastAccessTime)); |
552 | buf->st_mtim = filetime_to_timespec(&(findbuf.ftLastWriteTime)); | 553 | buf->st_mtim = filetime_to_timespec(&(findbuf.ftLastWriteTime)); |
@@ -555,6 +556,7 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) | |||
555 | else { | 556 | else { |
556 | /* The file is not a symlink. */ | 557 | /* The file is not a symlink. */ |
557 | buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); | 558 | buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); |
559 | buf->st_attr = fdata.dwFileAttributes; | ||
558 | if (S_ISREG(buf->st_mode) && | 560 | if (S_ISREG(buf->st_mode) && |
559 | (has_exe_suffix(file_name) || has_exec_format(file_name))) | 561 | (has_exe_suffix(file_name) || has_exec_format(file_name))) |
560 | buf->st_mode |= S_IXUSR|S_IXGRP|S_IXOTH; | 562 | buf->st_mode |= S_IXUSR|S_IXGRP|S_IXOTH; |
@@ -642,6 +644,7 @@ int mingw_fstat(int fd, struct mingw_stat *buf) | |||
642 | return -1; | 644 | return -1; |
643 | } | 645 | } |
644 | buf->st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; | 646 | buf->st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; |
647 | buf->st_attr = FILE_ATTRIBUTE_NORMAL; | ||
645 | buf->st_size = buf64.st_size; | 648 | buf->st_size = buf64.st_size; |
646 | buf->st_atim.tv_sec = buf64.st_atime; | 649 | buf->st_atim.tv_sec = buf64.st_atime; |
647 | buf->st_atim.tv_nsec = 0; | 650 | buf->st_atim.tv_nsec = 0; |
@@ -660,6 +663,7 @@ int mingw_fstat(int fd, struct mingw_stat *buf) | |||
660 | 663 | ||
661 | if (GetFileInformationByHandle(fh, &fdata)) { | 664 | if (GetFileInformationByHandle(fh, &fdata)) { |
662 | buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); | 665 | buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); |
666 | buf->st_attr = fdata.dwFileAttributes; | ||
663 | buf->st_size = fdata.nFileSizeLow | | 667 | buf->st_size = fdata.nFileSizeLow | |
664 | (((off64_t)fdata.nFileSizeHigh)<<32); | 668 | (((off64_t)fdata.nFileSizeHigh)<<32); |
665 | buf->st_atim = filetime_to_timespec(&(fdata.ftLastAccessTime)); | 669 | buf->st_atim = filetime_to_timespec(&(fdata.ftLastAccessTime)); |