fix: add format printf to panic

main
Sean McBride 4 years ago
parent df043c5a4a
commit f93da9e766

@ -4,7 +4,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
__attribute__((noreturn)) static inline void __attribute__((noreturn, format(printf, 1, 2))) static inline void
panic(const char *format, ...) panic(const char *format, ...)
{ {
va_list args; va_list args;

@ -441,7 +441,7 @@ sandbox_free(struct sandbox *sandbox)
errno = 0; errno = 0;
rc = munmap(stkaddr, stksz); rc = munmap(stkaddr, stksz);
if (rc == -1) { if (rc == -1) {
error_message = "Failed to unmap stack"; fprintf(stderr, "Thread %lu | Failed to unmap stack %p\n", pthread_self(), sandbox);
goto err_free_stack_failed; goto err_free_stack_failed;
}; };
@ -455,7 +455,7 @@ sandbox_free(struct sandbox *sandbox)
errno = 0; errno = 0;
rc = munmap(sandbox, sandbox_address_space_size); rc = munmap(sandbox, sandbox_address_space_size);
if (rc == -1) { if (rc == -1) {
error_message = "Failed to unmap sandbox"; fprintf(stderr, "Thread %lu | Failed to unmap sanbox %p\n", pthread_self(), sandbox);
goto err_free_sandbox_failed; goto err_free_sandbox_failed;
}; };
@ -465,5 +465,5 @@ err_free_sandbox_failed:
err_free_stack_failed: err_free_stack_failed:
err: err:
/* Errors freeing memory is a fatal error */ /* Errors freeing memory is a fatal error */
panic(error_message); panic("Thread %lu | Failed to free sandbox %p\n", pthread_self(), sandbox);
} }

Loading…
Cancel
Save