From f93da9e76666c092f7ee6e0787dfe4d838d340e2 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 9 Jul 2020 17:47:08 -0400 Subject: [PATCH] fix: add format printf to panic --- runtime/include/panic.h | 2 +- runtime/src/sandbox.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/include/panic.h b/runtime/include/panic.h index 509a45f..d973c4b 100644 --- a/runtime/include/panic.h +++ b/runtime/include/panic.h @@ -4,7 +4,7 @@ #include #include -__attribute__((noreturn)) static inline void +__attribute__((noreturn, format(printf, 1, 2))) static inline void panic(const char *format, ...) { va_list args; diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index e056fed..1aec382 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -441,7 +441,7 @@ sandbox_free(struct sandbox *sandbox) errno = 0; rc = munmap(stkaddr, stksz); 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; }; @@ -455,7 +455,7 @@ sandbox_free(struct sandbox *sandbox) errno = 0; rc = munmap(sandbox, sandbox_address_space_size); 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; }; @@ -465,5 +465,5 @@ err_free_sandbox_failed: err_free_stack_failed: err: /* Errors freeing memory is a fatal error */ - panic(error_message); + panic("Thread %lu | Failed to free sandbox %p\n", pthread_self(), sandbox); }