diff options
| author | Andrey Konovalov <andreyknvl@gmail.com> | 2017-01-31 18:51:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-31 18:51:37 +0100 |
| commit | e7108f23a1c44d703c6a14ef9d7707957460921d (patch) | |
| tree | 1e4efa8429d8df94767264770842dbd592eb7469 /csource/csource.go | |
| parent | 8987a8546dbd1591894bca18a926ab613686eb7c (diff) | |
| parent | d875900eb8f656c37394ca2310e5943ef9b475bf (diff) | |
Merge pull request #124 from xairy/tun-fixes
Tun fixes
Diffstat (limited to 'csource/csource.go')
| -rw-r--r-- | csource/csource.go | 12 |
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") |
