Observing ftruncate results to remove error, adding comments to have better eyes look at a better way to recover from the problems

This commit is contained in:
Jay McCarthy 2010-05-18 09:18:45 -05:00
parent b66d31e7c1
commit b5ee4ac21b

View File

@ -379,8 +379,12 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
close (execfd);
goto retry_open;
}
ftruncate (execfd, offset);
return MFAIL;
if (ftruncate (execfd, offset)) {
// FIXME: Should fail "even worse" because the truncate failed
return MFAIL;
} else {
return MFAIL;
}
}
else if (!offset
&& open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat)
@ -391,8 +395,11 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
if (start == MFAIL)
{
munmap (ptr, length);
ftruncate (execfd, offset);
return start;
if (ftruncate (execfd, offset)) {
// FIXME: Should return failure, but how to recover work we've done?
1;
}
return start;
}
mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start;