зеркало из https://github.com/github/putty.git
Explicitly closing logctx on various kinds of error exit means that
the log file gets fclosed properly and the critical last few messages might be recoverable from the log file more often... [originally from svn r6834]
This commit is contained in:
Родитель
f0a9c33f25
Коммит
bb6482c35d
|
@ -25,6 +25,8 @@
|
|||
|
||||
#define MAX_STDIN_BACKLOG 4096
|
||||
|
||||
void *logctx;
|
||||
|
||||
void fatalbox(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -33,6 +35,10 @@ void fatalbox(char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void modalfatalbox(char *p, ...)
|
||||
|
@ -43,6 +49,10 @@ void modalfatalbox(char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void connection_fatal(void *frontend, char *p, ...)
|
||||
|
@ -53,6 +63,10 @@ void connection_fatal(void *frontend, char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void cmdline_error(char *p, ...)
|
||||
|
@ -556,7 +570,7 @@ int main(int argc, char **argv)
|
|||
int exitcode;
|
||||
int errors;
|
||||
int use_subsystem = 0;
|
||||
void *ldisc, *logctx;
|
||||
void *ldisc;
|
||||
long now;
|
||||
|
||||
fdlist = NULL;
|
||||
|
|
|
@ -29,6 +29,10 @@ void fatalbox(char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void modalfatalbox(char *p, ...)
|
||||
|
@ -39,6 +43,10 @@ void modalfatalbox(char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void connection_fatal(void *frontend, char *p, ...)
|
||||
|
@ -49,6 +57,10 @@ void connection_fatal(void *frontend, char *p, ...)
|
|||
vfprintf(stderr, p, ap);
|
||||
va_end(ap);
|
||||
fputc('\n', stderr);
|
||||
if (logctx) {
|
||||
log_free(logctx);
|
||||
logctx = NULL;
|
||||
}
|
||||
cleanup_exit(1);
|
||||
}
|
||||
void cmdline_error(char *p, ...)
|
||||
|
|
Загрузка…
Ссылка в новой задаче