diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2020-02-12 23:28:48 +0100 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-02-18 08:45:24 +1000 |
commit | fe66ddb115026a5e43fcf93b72780a9f281ec5d4 (patch) | |
tree | 588ef0c6ff560047ad8c5c19d98549c8ad9e1982 /jim-exec.c | |
parent | 468a4ad73cae9a566ab117780a447cbfa92496e6 (diff) | |
download | jimtcl-fe66ddb115026a5e43fcf93b72780a9f281ec5d4.zip jimtcl-fe66ddb115026a5e43fcf93b72780a9f281ec5d4.tar.gz jimtcl-fe66ddb115026a5e43fcf93b72780a9f281ec5d4.tar.bz2 |
exec: fix valgrind warning on close(-1)
When executing "exec.test" under valgrind, it reports several
warning messages
Warning: invalid file descriptor -1 in syscall close()
Add proper check around close()
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'jim-exec.c')
-rw-r--r-- | jim-exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1066,10 +1066,10 @@ badargs: close(errorId); } /* Close parent-only file descriptors */ - if (outPipePtr) { + if (outPipePtr && *outPipePtr != -1) { close(*outPipePtr); } - if (errFilePtr) { + if (errFilePtr && *errFilePtr != -1) { close(*errFilePtr); } if (pipeIds[0] != -1) { |