From b96171b138fe71092142a1c09bd31f491e86657a Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 31 Mar 2021 08:37:48 +0000 Subject: [PATCH] Do not exit if cannot write to normal log file, GitHub issue 2630. --- usr.bin/tmux/log.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/usr.bin/tmux/log.c b/usr.bin/tmux/log.c index 0bbcb1f7ff5..e52297aa464 100644 --- a/usr.bin/tmux/log.c +++ b/usr.bin/tmux/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.26 2019/09/24 20:44:58 nicm Exp $ */ +/* $OpenBSD: log.c,v 1.27 2021/03/31 08:37:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -111,15 +111,16 @@ log_vwrite(const char *msg, va_list ap) return; if (vasprintf(&fmt, msg, ap) == -1) - exit(1); - if (stravis(&out, fmt, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL) == -1) - exit(1); + return; + if (stravis(&out, fmt, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL) == -1) { + free(fmt); + return; + } gettimeofday(&tv, NULL); if (fprintf(log_file, "%lld.%06d %s\n", (long long)tv.tv_sec, - (int)tv.tv_usec, out) == -1) - exit(1); - fflush(log_file); + (int)tv.tv_usec, out) != -1) + fflush(log_file); free(out); free(fmt); -- 2.20.1