From: Jeff Lucovsky Date: Sat, 11 Jan 2025 14:23:50 +0000 (-0500) Subject: log/file: Ensure file ctx pointer is returned . X-Git-Tag: suricata-8.0.0-beta1~578 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12375%2Fhead;p=thirdparty%2Fsuricata.git log/file: Ensure file ctx pointer is returned . The fix for issue 7447 introduced an error with threaded eve output. The changes that were committed for that issue mishandled the return value when a file is being opened for the 2nd or higher time. Instead of returning the existing file context, null was returned. --- diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 90f18133a4..4844811004 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -737,6 +737,8 @@ LogFileCtx *LogFileEnsureExists(ThreadId thread_id, LogFileCtx *parent_ctx) "Unable to open slot %d for file %s", entry->slot_number, parent_ctx->filename); (void)HashTableRemove(parent_ctx->threads->ht, entry, 0); } + } else { + ret_ctx = entry->ctx; } SCMutexUnlock(&parent_ctx->threads->mutex);