fix bug 2603717. Ensure all elf program headers are copied.
When stripping a binary, soslim calls adjust_elf. adjust_elf
copies over the elf program headers, making adjustments
as necessary. Under some circumstances, the code which loops
over all the program headers will fail to call gelf_update_phdr().
Instead of copying over the elf program header from the old
binary to the new binary, a "NULL" header is written to the
binary.
Change-Id: I7afdc8e3af2638c386546f1bfe4f151e1f002087
diff --git a/elfcopy.c b/elfcopy.c
index 1a32a59..ed1e6ce 100644
--- a/elfcopy.c
+++ b/elfcopy.c
@@ -1057,6 +1057,8 @@
INFO("PT_ header type: %d does not contain any sections.\n",
phdr_info[pi].p_type);
/* Move to the next program header. */
+ FAILIF_LIBELF(gelf_update_phdr (newelf, pi, &phdr_info[pi]) == 0,
+ gelf_update_phdr);
continue;
}