Skip to content

Commit

Permalink
Adjust roundUp for 0 as input
Browse files Browse the repository at this point in the history
Round up 0 to m instead of wrapping around and return an unexpected
result, which is not a multiple of m.
  • Loading branch information
cgzones committed Feb 22, 2023
1 parent e37f892 commit 5b88266
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ static void writeFile(const std::string & fileName, const FileContents & content

static uint64_t roundUp(uint64_t n, uint64_t m)
{
if (n == 0)
return m;
return ((n - 1) / m + 1) * m;
}

Expand Down

0 comments on commit 5b88266

Please sign in to comment.