diff src/channel.c @ 21992:d9acf1e1c799 v8.2.1545

patch 8.2.1545: ch_logfile() is unclear about closing when forking Commit: https://github.com/vim/vim/commit/76603baac5a14445d0c41d7eb14144a07288d357 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 30 17:24:37 2020 +0200 patch 8.2.1545: ch_logfile() is unclear about closing when forking Problem: ch_logfile() is unclear about closing when forking. Solution: Adjust the log messages.
author Bram Moolenaar <Bram@vim.org>
date Sun, 30 Aug 2020 17:30:07 +0200
parents 88070e222e82
children 335365fcbb60
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -144,6 +144,7 @@ fd_close(sock_T fd)
 
 // Log file opened with ch_logfile().
 static FILE *log_fd = NULL;
+static char_u *log_name = NULL;
 #ifdef FEAT_RELTIME
 static proftime_T log_start;
 #endif
@@ -158,7 +159,7 @@ ch_logfile(char_u *fname, char_u *opt)
 	if (*fname != NUL)
 	    ch_log(NULL, "closing this logfile, opening %s", fname);
 	else
-	    ch_log(NULL, "closing logfile");
+	    ch_log(NULL, "closing logfile %s", log_name);
 	fclose(log_fd);
     }
 
@@ -170,6 +171,8 @@ ch_logfile(char_u *fname, char_u *opt)
 	    semsg(_(e_notopen), fname);
 	    return;
 	}
+	vim_free(log_name);
+	log_name = vim_strsave(fname);
     }
     log_fd = file;