From b016d304fbad338c29c9c1aceea9631b59953d84 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Sun, 18 Sep 2022 18:59:47 -0400 Subject: [PATCH] strerror -> strerror_r (#43) --- termbox.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/termbox.h b/termbox.h index c346df5..f653178 100644 --- a/termbox.h +++ b/termbox.h @@ -667,6 +667,7 @@ struct tb_global_t { int initialized; int (*fn_extract_esc_pre)(struct tb_event *, size_t *); int (*fn_extract_esc_post)(struct tb_event *, size_t *); + char errbuf[1024]; }; static struct tb_global_t global = {0}; @@ -1874,7 +1875,8 @@ const char *tb_strerror(int err) { case TB_ERR_RESIZE_POLL: case TB_ERR_RESIZE_READ: default: - return strerror(global.last_errno); + strerror_r(global.last_errno, global.errbuf, sizeof(global.errbuf)); + return (const char *)global.errbuf; } } -- 2.39.5