blob: d405674f204e0301b57e0d4dc656d00e52b3f199 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
--- a/src/torrent/utils/log.cc
+++ b/src/torrent/utils/log.cc
@@ -296,8 +296,11 @@ log_open_output(const char* name, log_slot slot) {
- if (log_find_output_name(name) != log_outputs.end()) {
- pthread_mutex_unlock(&log_mutex);
- throw input_error("Log name already used.");
+ log_output_list::iterator itr = log_find_output_name(name);
+ if (itr == log_outputs.end()) {
+ log_outputs.push_back(std::make_pair(name, slot));
+ } else {
+ // by replacing the "write" slot binding, the old file gets closed
+ // (handles are shared pointers)
+ itr->second = slot;
}
- log_outputs.push_back(std::make_pair(name, slot));
log_rebuild_cache();
|