summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/namedev.c b/namedev.c
index c8217024c8..fe7dddaf55 100644
--- a/namedev.c
+++ b/namedev.c
@@ -454,10 +454,8 @@ static int execute_program(char *path, char *value, int len)
switch(pid) {
case 0:
/* child */
- close(STDOUT_FILENO);
-
- /* dup write side of pipe to STDOUT */
- dup(fds[1]);
+ /* dup2 write side of pipe to STDOUT */
+ dup2(fds[1], STDOUT_FILENO);
if (argv[0] != NULL) {
dbg("execute '%s' with given arguments", argv[0]);
retval = execv(argv[0], argv);