1 From 3292b8c6f1e5fcc405fa0f7a20e90a60f74037b2 Mon Sep 17 00:00:00 2001
2 From: Matt Johnston <matt@ucc.asn.au>
3 Date: Sun, 12 Feb 2023 23:00:00 +0800
4 Subject: Use write() rather than fprintf() in segv handler
6 fprintf isn't guaranteed safe (though hasn't had any problems reported).
8 svr-main.c | 8 ++++++--
9 1 file changed, 6 insertions(+), 2 deletions(-)
13 @@ -420,8 +420,12 @@ static void sigchld_handler(int UNUSED(u
16 static void sigsegv_handler(int UNUSED(unused)) {
17 - fprintf(stderr, "Aiee, segfault! You should probably report "
18 - "this as a bug to the developer\n");
20 + const char *msg = "Aiee, segfault! You should probably report "
21 + "this as a bug to the developer\n";
22 + i = write(STDERR_FILENO, msg, strlen(msg));
23 + /* ignore short writes */