Skip to content

Commit

Permalink
Set interpreter only when necessary
Browse files Browse the repository at this point in the history
If the given interpreter is already set, nothing needs to be done.
As with modifySoname(), it skips unnecessary processing.
  • Loading branch information
yuta-hayama authored and Mic92 committed Nov 18, 2024
1 parent fd9c6de commit 0a64a88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,11 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string &
template<ElfFileParams>
void ElfFile<ElfFileParamNames>::setInterpreter(const std::string & newInterpreter)
{
if (getInterpreter() == newInterpreter) {
debug("given interpreter is already set\n");
return;
}

std::string & section = replaceSection(".interp", newInterpreter.size() + 1);
setSubstr(section, 0, newInterpreter + '\0');
changed = true;
Expand Down

0 comments on commit 0a64a88

Please sign in to comment.