summaryrefslogtreecommitdiff
path: root/src/strip.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-03-04 20:04:18 +0100
committerMark Wielaard <mark@klomp.org>2019-06-24 23:53:02 +0200
commit1fc628e71c920c0ef35594ebffe1ddf89f868905 (patch)
tree923812d0f817319b4d09c7eb48b2d6a79002c0f4 /src/strip.c
parentd08c68fec94b26663257d24dbb8d94f2ed8935cd (diff)
downloadelfutils-1fc628e71c920c0ef35594ebffe1ddf89f868905.tar.gz
strip don't mmap debug output file.
Using ELF_C_WRITE_MMAP sometimes causes unexpected errors when disk space is low. When writing out the file, the output file is first extended so that it covers the whole file/mmap size. But it might be that the file system allowed the extension as a sparse file. In that case writing to the file through the mmap might still fail and produce a SIGBUS if the disk is full. This is confusing to the user. Using ELF_C_WRITE will produce "normal" errors when the file cannot be written out. It also seems to use less memory because the debug file is created from scratch. So the memory is first read into the ELF data structure buffers, then written out as a whole. In this case the mmap output buffer is just overhead. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src/strip.c')
-rw-r--r--src/strip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/strip.c b/src/strip.c
index 4cd87506..48792a70 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1097,7 +1097,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
if (debug_fname != NULL)
{
/* Also create an ELF descriptor for the debug file */
- debugelf = elf_begin (debug_fd, ELF_C_WRITE_MMAP, NULL);
+ debugelf = elf_begin (debug_fd, ELF_C_WRITE, NULL);
if (unlikely (gelf_newehdr (debugelf, gelf_getclass (elf)) == 0))
{
error (0, 0, gettext ("cannot create new ehdr for file '%s': %s"),