]> granicus.if.org Git - libevent/commitdiff
Fix O_RDONLY (_O_RDONLY) under mingw
authorAzat Khuzhin <azat@libevent.org>
Tue, 27 Apr 2021 06:03:42 +0000 (09:03 +0300)
committerAzat Khuzhin <azat@libevent.org>
Tue, 27 Apr 2021 06:04:01 +0000 (09:04 +0300)
O_RDONLY is defined only if [1]:

    !defined(NO_OLDNAMES) || defined(_POSIX)

  [1]: https://github.com/Alexpux/mingw-w64/blob/d0d7f784833bbb0b2d279310ddc6afb52fe47a46/mingw-w64-headers/crt/fcntl.h#L35

arc4random.c
evutil.c

index cde22d0afeaae7cafd4267de64bca908cb8864da..c36e3c11b0a2f8abf73ed538f061298e193e77f4 100644 (file)
@@ -89,6 +89,10 @@ struct arc4_stream {
 #define pid_t int
 #endif
 
+#ifndef O_RDONLY
+#define O_RDONLY _O_RDONLY
+#endif
+
 static int rs_initialized;
 static struct arc4_stream rs;
 static pid_t arc4_stir_pid;
index 95d426ac49f9509000912646fcf1ce831ffae020..69c6f205a623f581961323c7dfc05096eb7ca6d6 100644 (file)
--- a/evutil.c
+++ b/evutil.c
 #define mode_t int
 #endif
 
+#ifndef O_RDONLY
+#define O_RDONLY _O_RDONLY
+#endif
+
 #ifdef EVENT__HAVE_AFUNIX_H
 int have_working_afunix_ = -1;
 #endif