summaryrefslogtreecommitdiff
path: root/compat/msvc.h
diff options
context:
space:
mode:
authorPhilip Oakley <philipoakley@iee.org>2019-06-19 21:06:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-20 21:03:05 (GMT)
commita822fb853a60c9a13438d6351622b62501de5a32 (patch)
treec8afd6a6073c82017dfa963e18e7ef222c218863 /compat/msvc.h
parent7ca46634bc086568b106e06b0637a0b643f2c78d (diff)
downloadgit-a822fb853a60c9a13438d6351622b62501de5a32.zip
git-a822fb853a60c9a13438d6351622b62501de5a32.tar.gz
git-a822fb853a60c9a13438d6351622b62501de5a32.tar.bz2
msvc: define O_ACCMODE
This constant is not defined in MSVC's headers. In UCRT's fcntl.h, _O_RDONLY, _O_WRONLY and _O_RDWR are defined as 0, 1 and 2, respectively. Yes, that means that UCRT breaks with the tradition that O_RDWR == O_RDONLY | O_WRONLY. It is a perfectly legal way to define those constants, though, therefore we need to take care of defining O_ACCMODE accordingly. This is particularly important in order to keep our "open() can set errno to EISDIR" emulation working: it tests that (flags & O_ACCMODE) is not identical to O_RDONLY before going on to test specifically whether the file for which open() reported EACCES is, in fact, a directory. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/msvc.h')
-rw-r--r--compat/msvc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/msvc.h b/compat/msvc.h
index 04b4750..d336d80 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -19,6 +19,8 @@
#undef ERROR
typedef int sigset_t;
+/* open for reading, writing, or both (not in fcntl.h) */
+#define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
#include "compat/mingw.h"