From 6cad09ec9c801e90d41f53ebcd673ef89050cc86 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 11 Feb 2022 17:41:33 +0100 Subject: Check if file to read is really a file --- executor/x86_64/asm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'executor') diff --git a/executor/x86_64/asm.c b/executor/x86_64/asm.c index f57f117..718ebef 100644 --- a/executor/x86_64/asm.c +++ b/executor/x86_64/asm.c @@ -206,7 +206,7 @@ int asm_init(Asm *self) { amal_log_debug("asm: page size: %u", self->allocated_size); self->code = mmap(NULL, self->allocated_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if(self->code == MAP_FAILED) - return -errno; + return -1; self->code_it = self->code; return 0; } @@ -253,7 +253,7 @@ typedef union { int asm_execute(Asm *self, u32 offset) { RawFuncCallPtr raw_func_ptr; if(mprotect(self->code, self->allocated_size, PROT_READ | PROT_EXEC) != 0) - return -errno; + return -1; /*asm_print_code_hex(self);*/ @@ -270,7 +270,7 @@ int asm_ensure_capacity(Asm *self, usize size) { usize new_size = self->allocated_size + am_pagesize(); void *new_mem = mmap(NULL, new_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if(new_mem == MAP_FAILED) - return -errno; + return -1; am_memcpy(new_mem, self->code, self->allocated_size); munmap(self->code, self->allocated_size); -- cgit v1.2.3