From 18a6c61956badc62ba9833e7909c9139dfbe011a Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 6 Apr 2011 09:59:54 +0000 Subject: [PATCH] * Fixed a corner-case where initial seeding would end up crashing rtorrent. * Fixed a bad conditional that would result in write syscall being called with -1 for logging executing external commands. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1201 e378c898-3ddf-0310-93e7-cc216c733640 --- src/rpc/exec_file.cc | 2 +- src/rpc/scgi_task.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rpc/exec_file.cc b/src/rpc/exec_file.cc index 8a38b4af..fbeee4f6 100644 --- a/src/rpc/exec_file.cc +++ b/src/rpc/exec_file.cc @@ -141,7 +141,7 @@ ExecFile::execute(const char* file, char* const* argv, int flags) { throw torrent::internal_error("ExecFile::execute(...) waitpid failed."); // Check return value? - if (m_logFd) { + if (m_logFd != -1) { if (status == 0) write(m_logFd, "\n--- Success ---\n", sizeof("\n--- Success ---\n")); else diff --git a/src/rpc/scgi_task.cc b/src/rpc/scgi_task.cc index 7000ac63..8ea5fcba 100644 --- a/src/rpc/scgi_task.cc +++ b/src/rpc/scgi_task.cc @@ -64,7 +64,7 @@ SCgiTask::realloc_buffer(uint32_t size, const char* buffer, uint32_t bufferSize) char* tmp = rak::cacheline_allocator::alloc_size(size); std::memcpy(tmp, buffer, bufferSize); - delete [] m_buffer; + ::free(m_buffer); m_buffer = tmp; } @@ -96,7 +96,7 @@ SCgiTask::close() { get_fd().close(); get_fd().clear(); - delete [] m_buffer; + ::free(m_buffer); m_buffer = NULL; // Test