diff --git a/reactos/lib/msvcrt/sys_stat/fstat.c b/reactos/lib/msvcrt/sys_stat/fstat.c index 8c39b6cf17c..fca4278bc42 100644 --- a/reactos/lib/msvcrt/sys_stat/fstat.c +++ b/reactos/lib/msvcrt/sys_stat/fstat.c @@ -37,6 +37,10 @@ int _fstat(int fd, struct stat *statbuf) statbuf->st_dev = fd; statbuf->st_size = FileInformation.nFileSizeLow; + statbuf->st_mode = S_IREAD; + if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) statbuf->st_mode |= S_IFDIR; + if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) statbuf->st_mode |= S_IWRITE; + return 0; } @@ -63,5 +67,8 @@ __int64 _fstati64 (int fd, struct _stati64* statbuf) statbuf->st_dev = fd; statbuf->st_size = (((__int64)FileInformation.nFileSizeHigh) << 32) + FileInformation.nFileSizeLow; + statbuf->st_mode = S_IREAD; + if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) statbuf->st_mode |= S_IFDIR; + if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) statbuf->st_mode |= S_IWRITE; return 0; }