[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Fix connecting the stdin of tor-fw-helper to /dev/null



Author: Steven Murdoch <Steven.Murdoch@xxxxxxxxxxxx>
Date: Wed, 1 Dec 2010 16:27:21 +0000
Subject: Fix connecting the stdin of tor-fw-helper to /dev/null
Commit: d5127ebdd86a5f2910e5cc6a0690fa6fac01f8db

This wasn't working due to the parameters of dup2 being in the wrong order.
As a result, tor-fw-helper was inheriting the stdin of Tor.
---
 src/common/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index 421da35..95d2b87 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2988,7 +2988,7 @@ tor_spawn_background(const char *const filename, int *stdout_read,
     /* Link stdin to /dev/null */
     fd = open("/dev/null", O_RDONLY); /* NOT cloexec, obviously. */
     if (fd != -1)
-      dup2(STDIN_FILENO, fd);
+      dup2(fd, STDIN_FILENO);
     else
       goto error;
 
-- 
1.7.1