strongswan.org
Wiki/Project Management
Downloads
Gitweb
projects
/
strongswan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a8fdc1
)
starter: Close open file descriptors after forking.
author
Tobias Brunner
<tobias@strongswan.org>
Thu, 13 Oct 2011 08:35:41 +0000
(10:35 +0200)
committer
Tobias Brunner
<tobias@strongswan.org>
Thu, 13 Oct 2011 09:19:17 +0000
(11:19 +0200)
This avoids problems with Android's adb which leaves several file
descriptors open when executing processes.
src/starter/starter.c
patch
|
blob
|
history
diff --git
a/src/starter/starter.c
b/src/starter/starter.c
index
659122a
..
b1a9a15
100644
(file)
--- a/
src/starter/starter.c
+++ b/
src/starter/starter.c
@@
-429,8
+429,11
@@
int main (int argc, char **argv)
{
case 0:
{
- int fnull
= open("/dev/null", O_RDWR)
;
+ int fnull;
+ closefrom(3);
+
+ fnull = open("/dev/null", O_RDWR);
if (fnull >= 0)
{
dup2(fnull, STDIN_FILENO);
@@
-438,6
+441,7
@@
int main (int argc, char **argv)
dup2(fnull, STDERR_FILENO);
close(fnull);
}
+
setsid();
}
break;