From f9fc10b394cdfbfc6f47c8b334872408e9a6bf22 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 22 Jan 2021 12:11:19 -0500 Subject: [PATCH] When not capturing don't try to create mmap. Fixes #3112 --- src/zm_monitor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 0630939db..2f35a053c 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -557,7 +557,12 @@ bool Monitor::connect() { Debug(3, "Connecting to monitor. Purpose is %d", purpose ); #if ZM_MEM_MAPPED snprintf(mem_file, sizeof(mem_file), "%s/zm.mmap.%d", staticConfig.PATH_MAP.c_str(), id); - map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0660); + if ( purpose != CAPTURE ) { + map_fd = open(mem_file, O_RDWR); + } else { + map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0660); + } + if ( map_fd < 0 ) { Error("Can't open memory map file %s, probably not enough space free: %s", mem_file, strerror(errno)); return false;