Skip to content

Commit

Permalink
fix win32 braindead _access()
Browse files Browse the repository at this point in the history
The Windows library call `_access()` styled after POSIX `access(2)`
only allows combinations of `R_OK` and `W_OK` and returns `EINVAL`
otherwise.

cf. https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess?view=msvc-170

v2: move to platform-specific header file
v3: just strip X_OK (@skullernet)
  • Loading branch information
sthalik authored and res2k committed Nov 23, 2023
1 parent f6e5ab7 commit 52106ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inc/shared/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define os_stat(p, s) _stat64(p, s)
#define os_fstat(f, s) _fstat64(f, s)
#define os_fileno(f) _fileno(f)
#define os_access(p, m) _access(p, m)
#define os_access(p, m) _access(p, (m) & ~X_OK)
#define Q_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#define Q_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define Q_STATBUF struct _stat64
Expand Down

0 comments on commit 52106ca

Please sign in to comment.