| * This file has no copyright assigned and is placed in the Public Domain. |
| * This file is part of the mingw-w64 runtime package. |
| * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| int __cdecl __mingw_access(const char *fname, int mode); |
| int __cdecl __mingw_access(const char *fname, int mode) |
| if (fname == NULL || (mode & ~(F_OK | X_OK | W_OK | R_OK))) |
| attr = GetFileAttributesA(fname); |
| if (attr == INVALID_FILE_ATTRIBUTES) |
| case ERROR_FILE_NOT_FOUND: |
| case ERROR_PATH_NOT_FOUND: |
| case ERROR_ACCESS_DENIED: |
| if (attr & FILE_ATTRIBUTE_DIRECTORY) |
| /* All directories have read & write access */ |
| if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK)) |
| /* no write permission on file */ |