# HG changeset patch # User Jeandet Alexis # Date 2014-06-18 20:01:42 # Node ID 4c09cf9ebb16c79f676fb70a4818dfa541129b29 # Parent 589c372f2986b8623d49c3873d285370b3175f32 removed elf_getphdrnum need for old Ubuntu versions... diff --git a/elf/elffile.cpp b/elf/elffile.cpp --- a/elf/elffile.cpp +++ b/elf/elffile.cpp @@ -776,18 +776,21 @@ void ElfFile::updateSections() void ElfFile::updateSegments() { - elf_getphdrnum (this->e , &this->SegmentCount); for(int i=0;iSegments.count();i++) { free(this->Segments.at(i)); } this->Segments.clear(); - for(int i=0;i<(int)this->SegmentCount;i++) + this->SegmentCount = 0; + GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); + while ( header == gelf_getphdr(this->e ,this->SegmentCount, header )) { - GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); - gelf_getphdr (this->e , i , header ); this->Segments.append(header); + this->SegmentCount++; + header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); } + this->SegmentCount = this->Segments.count(); + free(header); } void ElfFile::updateSymbols() diff --git a/elf/elfparser.cpp b/elf/elfparser.cpp --- a/elf/elfparser.cpp +++ b/elf/elfparser.cpp @@ -433,18 +433,21 @@ void elfparser::updateSections() void elfparser::updateSegments() { - elf_getphdrnum (this->e , &this->SegmentCount); for(int i=0;iSegments.count();i++) { free(this->Segments.at(i)); } this->Segments.clear(); - for(int i=0;i<(int)this->SegmentCount;i++) + this->SegmentCount = 0; + GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); + while ( header == gelf_getphdr(this->e ,this->SegmentCount, header )) { - GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); - gelf_getphdr (this->e , i , header ); this->Segments.append(header); + this->SegmentCount++; + header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); } + this->SegmentCount = this->Segments.count(); + free(header); }