diff --git a/amxmodx/amx.cpp b/amxmodx/amx.cpp index b1583521..d0d0c15e 100755 --- a/amxmodx/amx.cpp +++ b/amxmodx/amx.cpp @@ -60,9 +60,6 @@ #include #endif -extern int errno; -int errno; - // this file does not include amxmodx.h, so we have to include the memory manager here #ifdef MEMORY_TEST #include "mmgr/mmgr.h" diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index eeb71f55..39b816f9 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -35,6 +35,7 @@ #ifdef __linux__ #include +#include #endif #include "string.h" #include @@ -81,7 +82,6 @@ extern AMX_NATIVE_INFO vault_Natives[]; #define DLLOAD(path) (DLHANDLE)LoadLibrary(path) #define DLPROC(m,func) GetProcAddress(m,func) #define DLFREE(m) FreeLibrary(m) -extern int errno; #else #define DLLOAD(path) (DLHANDLE)dlopen(path, RTLD_NOW) #define DLPROC(m,func) dlsym(m,func) diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index fd5207e4..c2318a56 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -30,6 +30,8 @@ */ #ifdef __linux__ +#include +#include #include #endif #include "amxmodx.h" @@ -183,7 +185,8 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64 #ifndef __linux__ amx->base = new unsigned char[ amx->code_size ]; #else - posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size); + //posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size); + amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size); mprotect((void *)amx->base, amx->code_size, PROT_READ|PROT_WRITE|PROT_EXEC); #endif if ( amx->base )