mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
openssl: Disable file buffering for Win32 SSLKEYLOGFILE
Prior to this change SSLKEYLOGFILE used line buffering on WIN32 just like it does for other platforms. However, the Windows CRT does not actually support line buffering (_IOLBF) and will use full buffering (_IOFBF) instead. We can't use full buffering because multiple processes may be writing to the file and that could lead to corruption, and since full buffering is the only buffering available this commit disables buffering for Windows SSLKEYLOGFILE entirely (_IONBF). Ref: https://github.com/curl/curl/pull/1346#issuecomment-350530901
This commit is contained in:
parent
b1b94305d8
commit
7ab4e7adb9
@ -948,7 +948,11 @@ static int Curl_ossl_init(void)
|
|||||||
if(keylog_file_name && !keylog_file_fp) {
|
if(keylog_file_name && !keylog_file_fp) {
|
||||||
keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT);
|
keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT);
|
||||||
if(keylog_file_fp) {
|
if(keylog_file_fp) {
|
||||||
|
#ifdef WIN32
|
||||||
|
if(setvbuf(keylog_file_fp, NULL, _IONBF, 0)) {
|
||||||
|
#else
|
||||||
if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096)) {
|
if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096)) {
|
||||||
|
#endif
|
||||||
fclose(keylog_file_fp);
|
fclose(keylog_file_fp);
|
||||||
keylog_file_fp = NULL;
|
keylog_file_fp = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user