From 1230d4d2d300320f15f670d683c741a374bec3a0 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 23 Apr 2026 01:29:17 -0400 Subject: Check error condition when redirecting IO streams in child process --- src/lib/core/multiprocessing.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/core/multiprocessing.c b/src/lib/core/multiprocessing.c index 8d848fe..db45c7b 100644 --- a/src/lib/core/multiprocessing.c +++ b/src/lib/core/multiprocessing.c @@ -82,7 +82,11 @@ int child(struct MultiProcessingPool *pool, struct MultiProcessingTask *task) { fprintf(stderr, "unable to open '%s' for writing: %s\n", task->log_file, strerror(errno)); return -1; } - dup2(fileno(stdout), fileno(stderr)); + + if (dup2(STDOUT_FILENO, STDERR_FILENO) < 0) { + fclose(fp_log); + return -1; + } // Generate timestamp for log header time_t t = time(NULL); -- cgit