提交 a66be7b9 编写于 作者: T thartmann

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

Summary: Open compilation log files in write-mode and close before deletion attempt.
Reviewed-by: vlivanov
上级 7ba6c46b
......@@ -1845,7 +1845,7 @@ void CompileBroker::init_compiler_thread_log() {
os::file_separator(), thread_id, os::current_process_id());
}
fp = fopen(file_name, "at");
fp = fopen(file_name, "wt");
if (fp != NULL) {
if (LogCompilation && Verbose) {
tty->print_cr("Opening compilation log %s", file_name);
......
......@@ -55,8 +55,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);
}
......@@ -268,10 +270,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册