-
Notifications
You must be signed in to change notification settings - Fork 709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling fclose() on a NULL filehandle on win32 causes an assertion to fail #171
Conversation
Can one of the admins verify this patch? |
How can you get a NULL A few lines before (line 120) we have https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/log.c#L120
|
That is a very good question. I do not know how ctx->debug_file became NULL between the check and the fclose(). But it did, very consistently, as soon as I changed my opensc configuration to a higher log level. Our application is a GUI tool that starts a background thread to access the card. Most of the time that background thread blocks on a call like Could the file write be taking long enough that the call by the other thread is causing |
We have a different problem:
|
Doesn't So it sounds like the right fix is to:
Obviously, none of that will take care of the thread safety. Can (or should) |
Maybe the solution is to never close the handle and open it only once (if needed). Untested:
|
It's possible "to never close handle and to open it only once" By default, the debug file is opened before every log message and closed immediately after. |
@geoffbeier "fopen - fclose" frame for debug messages was introduced as a configuration option with the regards to OpenSC minidriver, that is accessed in a multi-thread mode, and the difficulties to share handle of debug file handle between these threads. |
No description provided.