Skip to content

Commit 6656cf1

Browse files
committed
[lldb] Call openlog only once and don't call closelog
1 parent c6599a0 commit 6656cf1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lldb/source/Host/common/Host.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ using namespace lldb_private;
9292
#if !defined(_WIN32)
9393
#include <syslog.h>
9494
void Host::SystemLog(llvm::StringRef message) {
95-
openlog("lldb", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);
95+
static llvm::once_flag g_openlog_once;
96+
llvm::call_once(g_openlog_once, [] {
97+
openlog("lldb", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);
98+
});
9699
syslog(LOG_INFO, "%s", message.data());
97-
closelog();
98100
}
99101
#else
100102
void Host::SystemLog(llvm::StringRef message) { llvm::errs() << message; }

0 commit comments

Comments
 (0)