Fix logging
Fix #98 (closed)
- volatile doesn't guarantee thread-safe, and there are time-of-check to time-of-use issue
- 0 is valid file descriptor value
- rist_get_global_logging_settings() has the TOCTOU problem
- use PTHREAD_MUTEX_INITIALIZER when available to avoid the overhead of pthread_once()
- fix memory leaks in error path
Edited by Zhao Zhili