summaryrefslogtreecommitdiffstats
path: root/src/elflint.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-10-05 17:32:29 +0200
committerMark Wielaard <[email protected]>2015-10-12 12:44:49 +0200
commitae1e85ea0b0d63968c707000ac893d9256eb9c38 (patch)
tree09d7662049f052342374b54132239bc5dc6b7196 /src/elflint.c
parent9b9666838eb8b3101bf461ae5e919b415657a0d1 (diff)
libelf: Only use posix_fallocate when using mmap. Ignore unsupported errors.
Don't use posix_fallocate when not using mmap. It is enough to ftruncate the file to the right size. pwrite will report an error if there is no disk space left. And on file systems that don't support fallocate it might duplicate writes in that case. When using posix_fallocate do ignore most errors. Other libc implementations don't guarantee the call actually works always and even with glibc there might be an unexpected error from the fallback code when the file system doesn't support fallocate. That is pretty nasty since we might get a SIGBUS in that case when writing to the mmapped memory. But the chance of that happening is very small. And will normally never happen with glibc. So only report an error when posix_fallocate reports ENOSPC. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/elflint.c')
0 files changed, 0 insertions, 0 deletions