From ef7c799c8f8a02e625f6891537b50ba2459cc99e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 28 May 2015 13:49:16 +0200 Subject: [PATCH] Fix race condition in MP log output MP-522 --- src/filter_log.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/filter_log.cpp b/src/filter_log.cpp index 4db9942..27ebadb 100644 --- a/src/filter_log.cpp +++ b/src/filter_log.cpp @@ -681,7 +681,11 @@ void yf::Log::Impl::process(mp::Package &package) { mp::odr odr(ODR_PRINT); odr_set_stream(odr, m_file->fhandle, stream_write, 0); + if (!m_file->fhandle) + yaz_log_lock(); z_GDU(odr, &gdu_req, 0, 0); + if (!m_file->fhandle) + yaz_log_unlock(); } } } @@ -776,7 +780,11 @@ void yf::Log::Impl::process(mp::Package &package) { mp::odr odr(ODR_PRINT); odr_set_stream(odr, m_file->fhandle, stream_write, 0); + if (!m_file->fhandle) + yaz_log_lock(); z_GDU(odr, &gdu_res, 0, 0); + if (!m_file->fhandle) + yaz_log_unlock(); } } } -- 1.7.10.4