summaryrefslogtreecommitdiff
path: root/test/lib/strlcat.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-08-08 21:38:05 -0400
committerTom Rini <trini@konsulko.com>2023-08-08 21:38:05 -0400
commit1e1437d9f8b5be362afdd0212dbae6c41f53f3d8 (patch)
tree7c22536424032112c0c5e3ddce45f0333478f355 /test/lib/strlcat.c
parenta169438411f9277cc689c14078151aa1d1caae3c (diff)
parent70fdcc704a978acb4de5e891469825596c0d292e (diff)
Merge branch '2023-08-08-assorted-code-corrections' into next
- A number of code corrections caught by Smatch and a few others as well.
Diffstat (limited to 'test/lib/strlcat.c')
-rw-r--r--test/lib/strlcat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lib/strlcat.c b/test/lib/strlcat.c
index a0ec037388b..d8453fe78e2 100644
--- a/test/lib/strlcat.c
+++ b/test/lib/strlcat.c
@@ -43,11 +43,11 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
s2[i] = 32 + 23 * i % (127 - 32);
s2[len2 - 1] = '\0';
- expected = len2 < n ? min(len1 + len2 - 1, n) : n;
+ expected = min(strlen(s2), n) + strlen(s1);
actual = strlcat(s2, s1, n);
if (expected != actual) {
ut_failf(uts, __FILE__, line, __func__,
- "strlcat(s2, s1, 2) == len2 < n ? min(len1 + len2, n) : n",
+ "strlcat(s2, s1, n) == min(len2, n) + len1",
"Expected %#zx (%zd), got %#zx (%zd)",
expected, expected, actual, actual);
return CMD_RET_FAILURE;