Added S_IFREG for files only.

svn path=/trunk/; revision=2894
This commit is contained in:
Hartmut Birr 2002-04-28 22:37:36 +00:00
parent 0bb4cfa71e
commit 9412a16ec8

View file

@ -45,7 +45,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_DIRECTORY)
statbuf->st_mode |= S_IFDIR;
else
statbuf->st_mode |= S_IFREG;
if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) statbuf->st_mode |= S_IWRITE;
return 0;
}
@ -74,7 +77,10 @@ __int64 _fstati64 (int fd, struct _stati64* statbuf)
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_DIRECTORY)
statbuf->st_mode |= S_IFDIR;
else
statbuf->st_mode |= S_IFREG;
if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) statbuf->st_mode |= S_IWRITE;
return 0;
}