summaryrefslogtreecommitdiff
path: root/src/test/test-copy.c
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2022-03-29 19:43:01 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 21:10:43 +0200
commitd66b77b4d8be4119a5322715f58f763a872ae322 (patch)
tree63f02c0308c09b5e12c3e1bf6e95efc7bbea0c74 /src/test/test-copy.c
parent53877d0385129a7b4b4a8ebb8a43982252bc7650 (diff)
downloadsystemd-d66b77b4d8be4119a5322715f58f763a872ae322.tar.gz
test-copy: use non-0 data block in copy_holes
Some filesystems (e.g. zfs with compression!=off, which is the default configuration) automatically hole-punch all-zero blocks ‒ write a block full of ones instead
Diffstat (limited to 'src/test/test-copy.c')
-rw-r--r--src/test/test-copy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index 71836a307e..a669df644b 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -343,7 +343,8 @@ TEST_RET(copy_holes) {
assert_se(fstat(fd, &stat) >= 0);
blksz = stat.st_blksize;
- buf = alloca0(blksz);
+ buf = alloca_safe(blksz);
+ memset(buf, 1, blksz);
/* We need to make sure to create hole in multiples of the block size, otherwise filesystems (btrfs)
* might silently truncate/extend the holes. */