Initialized statbuf->st_mode in _stat() and _fstati64().

svn path=/trunk/; revision=2332
This commit is contained in:
Hartmut Birr 2001-11-01 10:37:58 +00:00
parent 1dafd03c3d
commit dbf14d8c26

View file

@ -37,6 +37,10 @@ int _fstat(int fd, struct stat *statbuf)
statbuf->st_dev = fd; statbuf->st_dev = fd;
statbuf->st_size = FileInformation.nFileSizeLow; 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; return 0;
} }
@ -63,5 +67,8 @@ __int64 _fstati64 (int fd, struct _stati64* statbuf)
statbuf->st_dev = fd; statbuf->st_dev = fd;
statbuf->st_size = (((__int64)FileInformation.nFileSizeHigh) << 32) + statbuf->st_size = (((__int64)FileInformation.nFileSizeHigh) << 32) +
FileInformation.nFileSizeLow; 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; return 0;
} }