csourse: emit remove_dir only when needed

This commit is contained in:
Andrey Konovalov 2016-11-29 19:02:58 +01:00
parent 6d413cab8f
commit 11e1b430a8
3 changed files with 6 additions and 2 deletions

View File

@ -519,6 +519,7 @@ static int do_sandbox_namespace()
}
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT)
static void remove_dir(const char* dir)
{
DIR* dp;
@ -587,6 +588,7 @@ retry:
exitf("rmdir(%s) failed", dir);
}
}
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT)
static uint64_t current_time_ms()

View File

@ -262,7 +262,7 @@ func preprocessCommonHeader(opts Options, handled map[string]int) (string, error
cmd.Args = append(cmd.Args, "-DSYZ_REPEAT")
}
for name, _ := range handled {
cmd.Args = append(cmd.Args, "-D__NR_" + name)
cmd.Args = append(cmd.Args, "-D__NR_"+name)
}
cmd.Stdin = strings.NewReader(commonHeader)
stderr := new(bytes.Buffer)
@ -279,7 +279,7 @@ func preprocessCommonHeader(opts Options, handled map[string]int) (string, error
continue
}
define := strings.TrimPrefix(arg, "-D")
out = strings.Replace(out, "#define " + define + " 1\n", "", -1)
out = strings.Replace(out, "#define "+define+" 1\n", "", -1)
}
return out, nil
}

View File

@ -538,6 +538,7 @@ static int do_sandbox_namespace()
}
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT)
// 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.
@ -614,6 +615,7 @@ retry:
exitf("rmdir(%s) failed", dir);
}
}
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT)
static uint64_t current_time_ms()