mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 02:28:09 +00:00
moved AFL_TMPDIR check further down and better error message
This commit is contained in:
@ -654,25 +654,6 @@ int main(int argc, char** argv, char** envp) {
|
||||
if (!strcmp(in_dir, out_dir))
|
||||
FATAL("Input and output directories can't be the same");
|
||||
|
||||
if ((tmp_dir = getenv("AFL_TMPDIR")) != NULL && !in_place_resume) {
|
||||
|
||||
char tmpfile[file_extension
|
||||
? strlen(tmp_dir) + 1 + 10 + 1 + strlen(file_extension) + 1
|
||||
: strlen(tmp_dir) + 1 + 10 + 1];
|
||||
if (file_extension) {
|
||||
sprintf(tmpfile, "%s/.cur_input.%s", tmp_dir, file_extension);
|
||||
} else {
|
||||
sprintf(tmpfile, "%s/.cur_input", tmp_dir);
|
||||
}
|
||||
if (access(tmpfile, F_OK) !=
|
||||
-1) // there is still a race condition here, but well ...
|
||||
FATAL("AFL_TMPDIR already has an existing temporary input file: %s",
|
||||
tmpfile);
|
||||
|
||||
} else
|
||||
|
||||
tmp_dir = out_dir;
|
||||
|
||||
if (dumb_mode) {
|
||||
|
||||
if (crash_mode) FATAL("-C and -n are mutually exclusive");
|
||||
@ -846,6 +827,26 @@ int main(int argc, char** argv, char** envp) {
|
||||
|
||||
if (!timeout_given) find_timeout();
|
||||
|
||||
if ((tmp_dir = getenv("AFL_TMPDIR")) != NULL && !in_place_resume) {
|
||||
|
||||
char tmpfile[file_extension
|
||||
? strlen(tmp_dir) + 1 + 10 + 1 + strlen(file_extension) + 1
|
||||
: strlen(tmp_dir) + 1 + 10 + 1];
|
||||
if (file_extension) {
|
||||
sprintf(tmpfile, "%s/.cur_input.%s", tmp_dir, file_extension);
|
||||
} else {
|
||||
sprintf(tmpfile, "%s/.cur_input", tmp_dir);
|
||||
}
|
||||
if (access(tmpfile, F_OK) !=
|
||||
-1) // there is still a race condition here, but well ...
|
||||
FATAL("AFL_TMPDIR already has an existing temporary input file: %s - if this is not from another instance, then just remove the file.",
|
||||
tmpfile);
|
||||
|
||||
} else
|
||||
|
||||
tmp_dir = out_dir;
|
||||
|
||||
|
||||
/* If we don't have a file name chosen yet, use a safe default. */
|
||||
|
||||
if (!out_file) {
|
||||
|
Reference in New Issue
Block a user