summaryrefslogtreecommitdiff
path: root/os-posix.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-07 12:16:19 -0500
committerpommicket <pommicket@gmail.com>2023-01-07 12:16:19 -0500
commit3a5d0834854b88d6139b96e93c84f9156fb63b33 (patch)
tree492ca9be8aca21751f0d9fa4572d37f6dc47c9e2 /os-posix.c
parent57c015b9c87312ae3cc3624e707b86e89618fbfd (diff)
fixed big problem with process_*
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/os-posix.c b/os-posix.c
index f34d33b..3e32c20 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -320,9 +320,12 @@ long long process_read_stderr(Process *proc, char *data, size_t size) {
}
static void process_close_pipes(Process *proc) {
- close(proc->stdin_pipe);
- close(proc->stdout_pipe);
- close(proc->stderr_pipe);
+ if (proc->stdin_pipe)
+ close(proc->stdin_pipe);
+ if (proc->stdout_pipe)
+ close(proc->stdout_pipe);
+ if (proc->stderr_pipe)
+ close(proc->stderr_pipe);
proc->stdin_pipe = 0;
proc->stdout_pipe = 0;
proc->stderr_pipe = 0;