summaryrefslogtreecommitdiffstats
path: root/libasm/asm_end.c
diff options
context:
space:
mode:
Diffstat (limited to 'libasm/asm_end.c')
-rw-r--r--libasm/asm_end.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index 5aab8dfa..99e95017 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -460,7 +460,11 @@ binary_end (AsmCtx_t *ctx)
else
ehdr->e_shstrndx = elf_ndxscn (shstrscn);
- gelf_update_ehdr (ctx->out.elf, ehdr);
+ if (unlikely (gelf_update_ehdr (ctx->out.elf, ehdr) == 0))
+ {
+ __libasm_seterrno (ASM_E_LIBELF);
+ result = -1;
+ }
/* Write out the ELF file. */
if (unlikely (elf_update (ctx->out.elf, ELF_C_WRITE_MMAP) < 0))