summaryrefslogtreecommitdiffstats
path: root/libasm
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-05-14 12:34:26 +0200
committerMark Wielaard <[email protected]>2015-05-27 17:10:48 +0200
commit77482c4bf63a92166191e0b8531e9781f6fddbf3 (patch)
treeac8b53653eddd09edc3314fd2af48d55f92af224 /libasm
parent2b250b759799eaa43bce1643b7072be8c5c19c01 (diff)
libelf: Use posix_fallocate instead of ftruncate to extend ELF file.
This fixes an obscure SIGBUS error when using ELF_C_WRITE_MMAP on an ELF file that needs extending when the underlying file system is (nearly) full. Use posix_fallocate to make sure the file content is really there. Using ftruncate might mean the file is extended, but space isn't allocated yet. This might cause a SIGBUS once we write into the mmapped space and the disk is full. Using fallocate might fail on some file systems. posix_fallocate is required to extend the file and allocate enough space even if the underlying filesystem would normally return EOPNOTSUPP or the kernel doesn't implement the fallocate syscall. Also posix_fallocate has been in glibc since 2.1.94, while support for fallocate was only added in 2.10 and kernel 2.6.23. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libasm')
0 files changed, 0 insertions, 0 deletions