Fix windows and wasm builds

This commit is contained in:
pancake 2024-08-08 06:37:25 +02:00 committed by pancake
parent fc8d6a9e35
commit e387de70e4

View File

@ -220,9 +220,16 @@ R_API bool r_sandbox_enable(bool e) {
} }
static inline int bytify(int v) { static inline int bytify(int v) {
#if R2__WINDOWS__ || __wasi__
// on windows, there are no WEXITSTATUS, the return value is right there
unsigned int uv = (unsigned int)v;
return (int) ((uv > 255)? 1: 0);
#else
// on unix, return code is (system() >> 8) & 0xff
if (v == -1 || WIFEXITED (v)) { if (v == -1 || WIFEXITED (v)) {
return WEXITSTATUS (v); return WEXITSTATUS (v);
} }
#endif
return 1; return 1;
} }