summaryrefslogtreecommitdiffstats
path: root/libelf/elf_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/elf_update.c')
-rw-r--r--libelf/elf_update.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libelf/elf_update.c b/libelf/elf_update.c
index 4ed899ff..3ac38a85 100644
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -67,6 +67,7 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
return -1;
}
+#if HAVE_DECL_POSIX_FALLOCATE
/* Try to map the file if this isn't done yet. */
if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP)
{
@@ -95,14 +96,12 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
&& (elf->maximum_size == ~((size_t) 0)
|| (size_t) size > elf->maximum_size))
{
-#if HAVE_DECL_POSIX_FALLOCATE
if (unlikely (posix_fallocate (elf->fildes, 0, size) != 0))
if (errno == ENOSPC)
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return -1;
}
-#endif
/* Extend the mmap address if needed. */
if (elf->cmd == ELF_C_RDWR_MMAP
@@ -127,6 +126,7 @@ write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
size = -1;
}
else
+#endif
{
/* The file is not mmaped. */
if ((class == ELFCLASS32