diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-28 15:57:48 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-28 15:57:48 +0200 |
commit | 4b8b6cce11623d208c03595a241d9af21fba04ba (patch) | |
tree | 4eeade587da0c33911d7792912bcc40c0c1240ca /src/program.c | |
parent | ec5e3c06084ef9c4b7fd71e4bb04af3fbe77bed9 (diff) |
Fix issues reported by cppcheck
Diffstat (limited to 'src/program.c')
-rw-r--r-- | src/program.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/program.c b/src/program.c index 6150616..be4f8cc 100644 --- a/src/program.c +++ b/src/program.c @@ -171,14 +171,15 @@ int program_exec_async(const char **args, int *process_id, int *stdin_file, int if(process_id) *process_id = pid; - if(stdin_file) + if(stdin_file) { close(stdin_fd[READ_END]); + *stdin_file = stdin_fd[WRITE_END]; + } - if(stdout_file) + if(stdout_file) { close(stdout_fd[WRITE_END]); - - *stdin_file = stdin_fd[WRITE_END]; - *stdout_file = stdout_fd[READ_END]; + *stdout_file = stdout_fd[READ_END]; + } return 0; } |