mirror of
https://github.com/reactos/reactos.git
synced 2024-08-07 19:58:21 +00:00
- Set the executable flag for some files in _stat.
svn path=/trunk/; revision=4415
This commit is contained in:
parent
fa9eae54dd
commit
f771a79dd9
|
@ -12,6 +12,7 @@ int _stat(const char* path, struct stat* buffer)
|
|||
{
|
||||
HANDLE findHandle;
|
||||
WIN32_FIND_DATAA findData;
|
||||
char* ext;
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
|
@ -46,7 +47,15 @@ int _stat(const char* path, struct stat* buffer)
|
|||
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
buffer->st_mode |= S_IFDIR;
|
||||
else
|
||||
{
|
||||
buffer->st_mode |= S_IFREG;
|
||||
ext = strrchr(path, '.');
|
||||
if (ext && (!stricmp(ext, ".exe") ||
|
||||
!stricmp(ext, ".com") ||
|
||||
!stricmp(ext, ".bat") ||
|
||||
!stricmp(ext, ".cmd")))
|
||||
buffer->st_mode |= S_IEXEC;
|
||||
}
|
||||
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
buffer->st_mode |= S_IWRITE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue