fix: properly close the XMLRPC log, resetting the handle after close

This commit is contained in:
pyroscope
2018-06-15 19:37:57 +02:00
parent 6c278668e4
commit 3d88ac2cc8
+5 -4
View File
@@ -113,14 +113,15 @@ ThreadWorker::change_xmlrpc_log() {
if (scgi() == NULL)
return;
if (scgi()->log_fd() != -1)
if (scgi()->log_fd() != -1) {
::close(scgi()->log_fd());
if (m_xmlrpcLog.empty()) {
scgi()->set_log_fd(-1);
control->core()->push_log("Closed XMLRPC log.");
return;
}
if (m_xmlrpcLog.empty())
return;
scgi()->set_log_fd(open(rak::path_expand(m_xmlrpcLog).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644));
if (scgi()->log_fd() == -1) {