]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
log/file: Ensure file ctx pointer is returned . 12375/head
authorJeff Lucovsky <jlucovsky@oisf.net>
Sat, 11 Jan 2025 14:23:50 +0000 (09:23 -0500)
committerJeff Lucovsky <jlucovsky@oisf.net>
Sat, 11 Jan 2025 15:02:41 +0000 (10:02 -0500)
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.

src/util-logopenfile.c

index 90f18133a4f56a8485aa6acfa6f19de3d79e0cf2..484481100490879ad45bdf30cec2b80d7fc79cd2 100644 (file)
@@ -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);