summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2023-02-15 11:52:42 -0800
committerBrian C. Lane <bcl@redhat.com>2023-02-15 11:52:42 -0800
commitd272bb5b5343fd288a204314654a7fbaea84528d (patch)
treeec5cf784b706dd3c3ab5e65d6f22c2a60f51e602
parent09c95d2feab0c087339886134dfe2dc04094348a (diff)
downloadparted-d272bb5b5343fd288a204314654a7fbaea84528d.tar.gz
tests: Fix formatting and snprintf warnings in tests.
The assert message includes sector values, which are long long int, so use the proper formatting of %lld. The snprintf warning complained about trying to write 258 bytes so I bumped the buffer size up to 259. The return value is already being checked for truncation so this is just to keep the compiler happy without having to suppress the warning.
-rw-r--r--libparted/tests/disk.c2
-rw-r--r--libparted/tests/symlink.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c
index f7b16a5..a2e304c 100644
--- a/libparted/tests/disk.c
+++ b/libparted/tests/disk.c
@@ -75,7 +75,7 @@ START_TEST (test_duplicate)
ck_assert_msg(part->geom.start == part_dup->geom.start &&
part->geom.end == part_dup->geom.end,
"Duplicated partition %d doesn't match. "
- "Details are start: %d/%d end: %d/%d\n",
+ "Details are start: %lld/%lld end: %lld/%lld\n",
*i, part->geom.start, part_dup->geom.start,
part->geom.end, part_dup->geom.end);
}
diff --git a/libparted/tests/symlink.c b/libparted/tests/symlink.c
index da6bef8..7be02cd 100644
--- a/libparted/tests/symlink.c
+++ b/libparted/tests/symlink.c
@@ -61,7 +61,7 @@ START_TEST (test_symlink)
here, but as /dev/mapper is root owned this is a non issue */
close (tmp_fd);
unlink (ln);
- char temp_disk_path[256];
+ char temp_disk_path[259];
int r = snprintf(temp_disk_path, sizeof temp_disk_path, "%s/%s",
cwd,
temporary_disk);