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

(cherry picked from commit 1d996c5aed820c34add5693a7a1bd4be00a1e304)

src/util-logopenfile.c

index 5f0cb01fe5ee0eda89ee5907d6b4912826093c3a..6f272bca65303deff19de69d87aca08f57433459 100644 (file)
@@ -735,6 +735,8 @@ LogFileCtx *LogFileEnsureExists(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);