summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/flashdisk01/test-file-system.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests/flashdisk01/test-file-system.c')
-rw-r--r--testsuites/libtests/flashdisk01/test-file-system.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/testsuites/libtests/flashdisk01/test-file-system.c b/testsuites/libtests/flashdisk01/test-file-system.c
index d3515d0743..52783732b9 100644
--- a/testsuites/libtests/flashdisk01/test-file-system.c
+++ b/testsuites/libtests/flashdisk01/test-file-system.c
@@ -596,8 +596,9 @@ static test_state do_file_append(unsigned index, fs_state *fs)
if (pos != (off_t) -1) {
size_t buf_size = sizeof(fs->buf);
+ size_t offset = HEADER_SIZE + 1;
long random = lrand48();
- size_t out = get_bucket_with_random(buf_size, random) + 1;
+ size_t out = get_bucket_with_random(buf_size - offset, random) + offset;
ssize_t out_actual = 0;
uint8_t *buf = fs->buf;
uint32_t value = (uint32_t) random;
@@ -605,9 +606,6 @@ static test_state do_file_append(unsigned index, fs_state *fs)
size_t word_count = 0;
size_t w = 0;
- /* Must be big enough for the header */
- out = out >= HEADER_SIZE ? out : HEADER_SIZE;
-
/*
* In case out is not an integral multiple of four we will write a bit to
* much. This does not hurt since the buffer is big enough.