Skip to content

Commit 76603ba

Browse files
committed
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.
1 parent 207f009 commit 76603ba

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/channel.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ fd_close(sock_T fd)
144144

145145
// Log file opened with ch_logfile().
146146
static FILE *log_fd = NULL;
147+
static char_u *log_name = NULL;
147148
#ifdef FEAT_RELTIME
148149
static proftime_T log_start;
149150
#endif
@@ -158,7 +159,7 @@ ch_logfile(char_u *fname, char_u *opt)
158159
if (*fname != NUL)
159160
ch_log(NULL, "closing this logfile, opening %s", fname);
160161
else
161-
ch_log(NULL, "closing logfile");
162+
ch_log(NULL, "closing logfile %s", log_name);
162163
fclose(log_fd);
163164
}
164165

@@ -170,6 +171,8 @@ ch_logfile(char_u *fname, char_u *opt)
170171
semsg(_(e_notopen), fname);
171172
return;
172173
}
174+
vim_free(log_name);
175+
log_name = vim_strsave(fname);
173176
}
174177
log_fd = file;
175178

src/os_unix.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4683,8 +4683,10 @@ mch_call_shell_fork(
46834683

46844684
# ifdef FEAT_JOB_CHANNEL
46854685
if (ch_log_active())
4686-
// close the log file in the child
4686+
{
4687+
ch_log(NULL, "closing channel log in the child process");
46874688
ch_logfile((char_u *)"", (char_u *)"");
4689+
}
46884690
# endif
46894691

46904692
if (!show_shell_mess || (options & SHELL_EXPAND))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1545,
757759
/**/
758760
1544,
759761
/**/

0 commit comments

Comments
 (0)