aboutsummaryrefslogtreecommitdiffstats
path: root/csource/csource.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-01-31 18:40:10 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-01-31 18:40:10 +0100
commitf3bb6d96be685a64af8050d57f5ced7ec75da2e0 (patch)
tree39482b00bb34df5bd7e4730ac6c423ec2603f5bf /csource/csource.go
parentdd4e19c77a5326ec907cdf89df0cf9fc41aa17d9 (diff)
executor: fix tun initialization when sandbox != none
Diffstat (limited to 'csource/csource.go')
-rw-r--r--csource/csource.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/csource/csource.go b/csource/csource.go
index 183c787ab..853ba2a0c 100644
--- a/csource/csource.go
+++ b/csource/csource.go
@@ -68,8 +68,8 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) {
generateTestFunc(w, opts, calls, "loop")
fmt.Fprint(w, "int main()\n{\n")
- fmt.Fprintf(w, "\tsetup_main_process(0, %v);\n", enableTun)
- fmt.Fprintf(w, "\tint pid = do_sandbox_%v();\n", opts.Sandbox)
+ fmt.Fprintf(w, "\tsetup_main_process();\n")
+ fmt.Fprintf(w, "\tint pid = do_sandbox_%v(0, %v);\n", opts.Sandbox, enableTun)
fmt.Fprint(w, "\tint status = 0;\n")
fmt.Fprint(w, "\twhile (waitpid(pid, &status, __WALL) != pid) {}\n")
fmt.Fprint(w, "\treturn 0;\n}\n")
@@ -77,8 +77,8 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) {
generateTestFunc(w, opts, calls, "test")
if opts.Procs <= 1 {
fmt.Fprint(w, "int main()\n{\n")
- fmt.Fprintf(w, "\tsetup_main_process(0, %v);\n", enableTun)
- fmt.Fprintf(w, "\tint pid = do_sandbox_%v();\n", opts.Sandbox)
+ fmt.Fprintf(w, "\tsetup_main_process();\n")
+ fmt.Fprintf(w, "\tint pid = do_sandbox_%v(0, %v);\n", opts.Sandbox, enableTun)
fmt.Fprint(w, "\tint status = 0;\n")
fmt.Fprint(w, "\twhile (waitpid(pid, &status, __WALL) != pid) {}\n")
fmt.Fprint(w, "\treturn 0;\n}\n")
@@ -87,8 +87,8 @@ func Write(p *prog.Prog, opts Options) ([]byte, error) {
fmt.Fprint(w, "\tint i;")
fmt.Fprintf(w, "\tfor (i = 0; i < %v; i++) {\n", opts.Procs)
fmt.Fprint(w, "\t\tif (fork() == 0) {\n")
- fmt.Fprintf(w, "\t\t\tsetup_main_process(i, %v);\n", enableTun)
- fmt.Fprintf(w, "\t\t\tdo_sandbox_%v();\n", opts.Sandbox)
+ fmt.Fprintf(w, "\t\t\tsetup_main_process();\n")
+ fmt.Fprintf(w, "\t\t\tdo_sandbox_%v(i, %v);\n", opts.Sandbox, enableTun)
fmt.Fprint(w, "\t\t\treturn 0;\n")
fmt.Fprint(w, "\t\t}\n")
fmt.Fprint(w, "\t}\n")