void-packages/srcpkgs/rtorrent/patches/properly-close-xmlrpc-log.p...

35 lines
978 B
Diff

From 3d88ac2cc89ad203eb9ea75e4933d36bbda4d04d Mon Sep 17 00:00:00 2001
From: pyroscope <pyroscope.project@gmail.com>
Date: Fri, 15 Jun 2018 19:37:57 +0200
Subject: [PATCH] fix: properly close the XMLRPC log, resetting the handle
after close
---
src/thread_worker.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git src/thread_worker.cc src/thread_worker.cc
index d6fa2f61..939d7026 100644
--- src/thread_worker.cc
+++ src/thread_worker.cc
@@ -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) {