mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-04 13:50:07 -05:00
pfrd: fix mod by zero error when all branches are filtered
This commit is contained in:
parent
bcd5fde5d8
commit
c06db9c3a0
3 changed files with 9 additions and 0 deletions
|
|
@ -204,6 +204,9 @@ namespace eppfrd
|
||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
uint64_t threshold;
|
uint64_t threshold;
|
||||||
|
|
||||||
|
if(sum_ == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
threshold = RND::rand64(sum_);
|
threshold = RND::rand64(sum_);
|
||||||
for(size_t i = 0; i < branchinfo_.size(); i++)
|
for(size_t i = 0; i < branchinfo_.size(); i++)
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ namespace msppfrd
|
||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
uint64_t threshold;
|
uint64_t threshold;
|
||||||
|
|
||||||
|
if(sum_ == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
threshold = RND::rand64(sum_);
|
threshold = RND::rand64(sum_);
|
||||||
for(size_t i = 0; i < branchinfo_.size(); i++)
|
for(size_t i = 0; i < branchinfo_.size(); i++)
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,9 @@ namespace pfrd
|
||||||
uint64_t idx;
|
uint64_t idx;
|
||||||
uint64_t threshold;
|
uint64_t threshold;
|
||||||
|
|
||||||
|
if(sum_ == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
threshold = RND::rand64(sum_);
|
threshold = RND::rand64(sum_);
|
||||||
for(size_t i = 0; i < branchinfo_.size(); i++)
|
for(size_t i = 0; i < branchinfo_.size(); i++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue