diff options
author | Chris Mason <clm@fb.com> | 2020-04-16 11:13:47 -0700 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2020-04-16 11:13:47 -0700 |
commit | 17703d4fdf13ca5a3284c796033a1146915bede7 (patch) | |
tree | d6ae3a5f872fdf01ee877a2a294cc23bb1c0fc60 | |
parent | 691e47dc6f9f4bb883b78b45a8a42bfee9a5526c (diff) | |
download | simoop-17703d4fdf13ca5a3284c796033a1146915bede7.tar.gz |
simoop: make sure oddsizes never returns zero sizes
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r-- | simoop.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1010,10 +1010,15 @@ static int open_path(char *path, int seq, char *postfix, int flags) static loff_t randomize_size(loff_t sz) { + loff_t val; if (!oddsizes) return sz; - return rand() % sz; + val = rand() % sz; + if (val == 0) + val = sz; + + return val; } static void maybe_fsync(int fd) |