mirror of https://github.com/wolfSSL/wolfssh.git
Don't close the client's log file while a thread can still write it
On the MSVC path the input thread is never waited on, it blocks in a console read with nothing to cancel it, so it can still be logging when main closes the file named by -E. - Flush the log there and let process exit close the stream - The POSIX path joins its threads first, it still closes the filepull/1171/head
parent
50ce6135f7
commit
62c0e2efa5
|
|
@ -1422,8 +1422,16 @@ int main(int argc, char** argv)
|
|||
/* Close the log last, wolfSSH_Cleanup() still logs and the callback
|
||||
* cannot be uninstalled. */
|
||||
if (logFileStream != NULL) {
|
||||
#ifdef _MSC_VER
|
||||
/* The terminal session's input thread is left running, it blocks in
|
||||
* a console read with nothing to cancel it. Flush the log and let
|
||||
* process exit close it, rather than close the stream out from under
|
||||
* a write that thread is making. */
|
||||
WFFLUSH(logFileStream);
|
||||
#else
|
||||
WFCLOSE(NULL, logFileStream);
|
||||
logFileStream = NULL;
|
||||
#endif
|
||||
}
|
||||
config_cleanup(&clientConfig);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue