]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: initialize buffer to make Coverity silent
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 27 Jan 2022 07:29:20 +0000 (16:29 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 27 Jan 2022 13:47:58 +0000 (13:47 +0000)
Follow-up for f82f0b993740f4a9a3719c4df7c185411710df2b.

Fixes CID#1469119.

src/test/test-copy.c

index 6c7b8d220bc43cdb5b74ae740c4c385662097fa8..2c17c9d83daf4537cd008016a0515675db8bf640 100644 (file)
@@ -329,6 +329,7 @@ TEST_RET(copy_holes) {
         struct stat stat;
         off_t blksz;
         int r, fd, fd_copy;
+        char *buf;
 
         fd = mkostemp_safe(fn);
         assert_se(fd >= 0);
@@ -343,7 +344,7 @@ TEST_RET(copy_holes) {
 
         assert_se(fstat(fd, &stat) >= 0);
         blksz = stat.st_blksize;
-        char buf[blksz];
+        buf = alloca0(blksz);
 
         /* We need to make sure to create hole in multiples of the block size, otherwise filesystems (btrfs)
          * might silently truncate/extend the holes. */