diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-23 01:29:17 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-23 01:29:17 -0400 |
| commit | 1230d4d2d300320f15f670d683c741a374bec3a0 (patch) | |
| tree | 8ee16d4ee2d916b24fc175e517bba50908d67ef8 /src/lib | |
| parent | 0b60dea8de5de9f6bf663d1f5b17a92a84f302b0 (diff) | |
| download | stasis-cmake-git-version-fixups.tar.gz | |
Check error condition when redirecting IO streams in child processcmake-git-version-fixups
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/core/multiprocessing.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |
