diff --git a/c/expeditor.c b/c/expeditor.c index 2c85ba101..00512da19 100644 --- a/c/expeditor.c +++ b/c/expeditor.c @@ -677,7 +677,7 @@ static void s_ee_set_color(int color_id, IBOOL background) { # include # include #endif -#if !defined(__GLIBC__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__EMSCRIPTEN__) && !defined(NO_USELOCALE) +#if !defined(__GLIBC__) && !defined(__COSMOPOLITAN__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__linux__) && !defined(__EMSCRIPTEN__) && !defined(NO_USELOCALE) # include #endif diff --git a/c/prim5.c b/c/prim5.c index 3e712c293..e164e9694 100644 --- a/c/prim5.c +++ b/c/prim5.c @@ -749,8 +749,8 @@ static ptr s_system(const char *s) { #ifdef WIN32 return Sinteger(status); #else - if WIFEXITED(status) return Sinteger(WEXITSTATUS(status)); - if WIFSIGNALED(status) return Sinteger(-WTERMSIG(status)); + if (WIFEXITED(status)) return Sinteger(WEXITSTATUS(status)); + if (WIFSIGNALED(status)) return Sinteger(-WTERMSIG(status)); S_error("system", "cannot determine subprocess exit status"); return 0 /* not reached */; #endif /* WIN32 */ diff --git a/c/version.h b/c/version.h index da4af287f..bb8be394c 100644 --- a/c/version.h +++ b/c/version.h @@ -86,9 +86,13 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { /*****************************************/ /* Operating systems */ -#if defined(__linux__) || defined(__GNU__) /* Hurd */ +#if defined(__linux__) || defined(__COSMOPOLITAN__) || defined(__GNU__) /* Hurd */ #define NOBLOCK O_NONBLOCK -#define LOAD_SHARED_OBJECT +/* cosmo dylib support is experimental, disable when using cosmo libc + https://github.com/jart/cosmopolitan/blob/3.3.10/libc/dlopen/dlopen.c#L801 */ +#ifndef __COSMOPOLITAN__ +# define LOAD_SHARED_OBJECT +#endif #define USE_MMAP #define MMAP_HEAP #define IEEE_DOUBLE