minor changes in MOO_STATIC_ASSERT() definition.
defined O_CLOEXEC to 0 when it's not defined
This commit is contained in:
parent
290b583f41
commit
762dcb3f66
@ -1043,8 +1043,10 @@ typedef struct moo_t moo_t;
|
||||
# define MOO_STATIC_ASSERT(expr) _Static_assert (expr, "invalid assertion")
|
||||
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
# define MOO_STATIC_ASSERT(expr) static_assert (expr, "invalid assertion")
|
||||
#else
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define MOO_STATIC_ASSERT(expr) typedef char MOO_STATIC_JOIN(MOO_STATIC_ASSERT_T_, __LINE__)[(expr)? 1: -1] MOO_UNUSED
|
||||
#else
|
||||
# define MOO_STATIC_ASSERT(expr) do { typedef char MOO_STATIC_JOIN(MOO_STATIC_ASSERT_T_, __LINE__)[(expr)? 1: -1] MOO_UNUSED; } while(0)
|
||||
#endif
|
||||
|
||||
#define MOO_STATIC_ASSERT_EXPR(expr) ((void)MOO_SIZEOF(char[(expr)? 1: -1]))
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(O_CLOEXEC)
|
||||
# define O_CLOEXEC 0 /* since it's not defined, 0 results in no effect when bitwise-ORed. */
|
||||
#endif
|
||||
|
||||
static moo_pfrc_t pf_open_file (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
{
|
||||
oop_io_t io;
|
||||
@ -93,10 +97,7 @@ static moo_pfrc_t pf_open_file (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
|
||||
goto oops;
|
||||
}
|
||||
|
||||
fl |= O_NONBLOCK;
|
||||
#if defined(O_CLOEXEC)
|
||||
fl |= O_CLOEXEC;
|
||||
#endif
|
||||
fl |= O_NONBLOCK | O_CLOEXEC;
|
||||
|
||||
if (fcntl(fd, F_SETFL, fl) == -1) goto fcntl_failure;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user