8007993: hotspot.log w/ enabled LogCompilation can be an invalid XML

Open compilation log files in write-mode and close before deletion attempt.

Reviewed-by: vlivanov
This commit is contained in:
Tobias Hartmann 2014-11-26 08:06:58 +01:00
parent 4bc2edad15
commit 137d39454d
2 changed files with 5 additions and 4 deletions

View file

@ -56,8 +56,10 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
}
CompileLog::~CompileLog() {
delete _out;
delete _out; // Close fd in fileStream::~fileStream()
_out = NULL;
// Remove partial file after merging in CompileLog::finish_log_on_error
unlink(_file);
FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
}
@ -278,10 +280,9 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
}
file->print_raw_cr("</compilation_log>");
close(partial_fd);
unlink(partial_file);
}
CompileLog* next_log = log->_next;
delete log;
delete log; // Removes partial file
log = next_log;
}
_first = NULL;