summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-09-06 11:49:07 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-11 17:51:44 -0400
commitea6e0450c85776ee4a578be239b87309fdc1142c (patch)
treed7d371a289ec105895860520d0a42c561ddee944
parent6e91fab5136433c1c2dc2f84304b848f078e97e4 (diff)
downloadqarsh-ea6e0450c85776ee4a578be239b87309fdc1142c.tar.gz
qarsh-ea6e0450c85776ee4a578be239b87309fdc1142c.tar.xz
qarsh-ea6e0450c85776ee4a578be239b87309fdc1142c.zip
Close both ends of the pipes so we don't leak file descriptors
-rw-r--r--qarshd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qarshd.c b/qarshd.c
index 093e001..915098c 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -127,6 +127,9 @@ run_cmd(const char *cmd)
dup2(parentfds[1], fileno(stdout));
dup2(parentfds[2], fileno(stderr));
/* close end of pipes we're not using */
+ close(parentfds[0]);
+ close(parentfds[1]);
+ close(parentfds[2]);
close(childfds[0]);
close(childfds[1]);
close(childfds[2]);