void Logger::LowLevelCodeCreateEvent(Code* code, LogMessageBuilder* msg) {
if (!FLAG_ll_prof || Log::output_code_handle_ == NULL) return;
int pos = static_cast<int>(ftell(Log::output_code_handle_));
- fwrite(code->instruction_start(), 1, code->instruction_size(),
- Log::output_code_handle_);
+ int rv = fwrite(code->instruction_start(), 1, code->instruction_size(),
+ Log::output_code_handle_);
+ ASSERT(static_cast<size_t>(code->instruction_size()) == rv);
+ USE(rv);
msg->Append(",%d", pos);
}
void* initial) {
FILE* file = fopen(name, "w+");
if (file == NULL) return NULL;
- fwrite(initial, size, 1, file);
+ int result = fwrite(initial, size, 1, file);
+ if (result < 1) {
+ fclose(file);
+ return NULL;
+ }
void* memory =
mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
return new PosixMemoryMappedFile(file, memory, size);