diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-05-18 20:24:41 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-06-12 19:48:23 +0200 |
| commit | ed6891f2edb833a3ba06dc656bb8cfe371d0bc6a (patch) | |
| tree | 1c03b260340fb340fcca8c3628915734dcdaf90e /executor/common.h | |
| parent | 19015af81522aa5d8aaa16d07306c48c3a61571e (diff) | |
csource: use tmp dir in repeat loop when tmpdir flag is on
Diffstat (limited to 'executor/common.h')
| -rw-r--r-- | executor/common.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/executor/common.h b/executor/common.h index ef2778f64..7f0bfb7f5 100644 --- a/executor/common.h +++ b/executor/common.h @@ -859,7 +859,7 @@ static int do_sandbox_namespace(int executor_pid, bool enable_tun) } #endif -#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT)) +#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT) && defined(SYZ_USE_TMP_DIR)) // One does not simply remove a directory. // There can be mounts, so we need to try to umount. // Moreover, a mount can be mounted several times, so we need to try to umount in a loop. @@ -948,7 +948,9 @@ retry: exitf("rmdir(%s) failed", dir); } } +#endif +#if defined(SYZ_EXECUTOR) || (defined(SYZ_REPEAT) && defined(SYZ_WAIT_REPEAT)) static uint64_t current_time_ms() { struct timespec ts; @@ -984,18 +986,22 @@ void loop() { int iter; for (iter = 0;; iter++) { +#ifdef SYZ_USE_TMP_DIR char cwdbuf[256]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) fail("failed to mkdir"); +#endif int pid = fork(); if (pid < 0) fail("clone failed"); if (pid == 0) { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); +#ifdef SYZ_USE_TMP_DIR if (chdir(cwdbuf)) fail("failed to chdir"); +#endif #ifdef SYZ_TUN_ENABLE flush_tun(); #endif @@ -1017,7 +1023,9 @@ void loop() break; } } +#ifdef SYZ_USE_TMP_DIR remove_dir(cwdbuf); +#endif } } #else |
