summaryrefslogtreecommitdiff
path: root/libproxy/modules
diff options
context:
space:
mode:
authornicolas.dufresne <nicolas.dufresne@c587cffe-e639-0410-9787-d7902ae8ed56>2011-01-03 16:33:57 +0000
committernicolas.dufresne <nicolas.dufresne@c587cffe-e639-0410-9787-d7902ae8ed56>2011-01-03 16:33:57 +0000
commit47d308a71cb02191db414a5802bcb7b441865319 (patch)
treed16f50ae3b5b8171532d6a2ac7a7d9da3a5d40fe /libproxy/modules
parent41d0d767a07e815ec4fa8b91ff20231450895400 (diff)
downloadlibproxy-47d308a71cb02191db414a5802bcb7b441865319.tar.gz
Close all uneeded file descriptors in pxgconf
When we start pxconf we fork but we don't close all the uneeded file descriptors. This has the side effect that any listening socket stays open even if closed by the parent process. git-svn-id: http://libproxy.googlecode.com/svn/trunk@776 c587cffe-e639-0410-9787-d7902ae8ed56
Diffstat (limited to 'libproxy/modules')
-rw-r--r--libproxy/modules/config_gnome.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libproxy/modules/config_gnome.cpp b/libproxy/modules/config_gnome.cpp
index 94cea01..ec5e2b3 100644
--- a/libproxy/modules/config_gnome.cpp
+++ b/libproxy/modules/config_gnome.cpp
@@ -102,10 +102,8 @@ static int popen2(const char *program, FILE** read, FILE** write, pid_t* pid) {
if (dup2(rpipe[1], STDOUT_FILENO) != STDOUT_FILENO) _exit(2);
// Close unneeded fds
- close(rpipe[0]);
- close(rpipe[1]);
- close(wpipe[0]);
- close(wpipe[1]);
+ for (int i = 3; i < sysconf(_SC_OPEN_MAX); i++)
+ close(i);
// Exec
execl("/bin/sh", "sh", "-c", program, (char*) NULL);