Files
third_party_elfutils/libelf
Mark Wielaard 77482c4bf6 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 <mjw@redhat.com>
2015-05-27 17:10:48 +02:00
..
2014-01-23 11:31:53 +01:00
2014-01-23 11:31:53 +01:00
2014-01-23 11:31:53 +01:00
2015-04-28 14:41:12 +02:00
2013-08-28 18:58:10 +02:00
2014-12-18 23:47:22 +01:00