diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-02-22 20:14:12 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2023-02-22 20:16:21 +0100 |
commit | 5b88266ce8a381c496d031cd46cc2f2fdf7ec8f8 (patch) | |
tree | f36069e5e2b42b14251d782997d61fcc511b6406 | |
parent | e37f892b12ff900ab5e733f688548c87cd14ef02 (diff) | |
download | patchelf-5b88266ce8a381c496d031cd46cc2f2fdf7ec8f8.tar.gz |
Adjust roundUp for 0 as input
Round up 0 to m instead of wrapping around and return an unexpected
result, which is not a multiple of m.
-rw-r--r-- | src/patchelf.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 126cada..859fe92 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -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; } |