diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-12-05 00:31:05 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-12-05 00:31:05 +0000 |
commit | 8dd8d56d95763ffc914bb729eb27d720cd8ab5eb (patch) | |
tree | 47e3e7f4f20dabb95968822ad94a6043f486e8bd | |
parent | aa9ce62be54fd9a022b770d36fb1e4f24bfcd223 (diff) | |
download | src-8dd8d56d95763ffc914bb729eb27d720cd8ab5eb.tar.gz src-8dd8d56d95763ffc914bb729eb27d720cd8ab5eb.zip |
posixshm_test: Fix sign mismatches in ?: results.
GCC 12's -Wsign-compare complains if the two alternative results of
the ?: operator are differently signed. Cast the small, sub-page
off_t values to size_t to quiet the warning.
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D37539
-rw-r--r-- | tests/sys/posixshm/posixshm_test.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c index c84eca319e0e..6398f5f6e085 100644 --- a/tests/sys/posixshm/posixshm_test.c +++ b/tests/sys/posixshm/posixshm_test.c @@ -195,7 +195,7 @@ shm_fill(int fd, off_t offset, off_t len) return (1); while (len > 0) { - blen = len < (off_t)page_size ? len : page_size; + blen = len < (off_t)page_size ? (size_t)len : page_size; memset(buf, byte_to_fill, blen); if (pwrite(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; @@ -236,7 +236,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = hole_start; resid = hole_len; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break; @@ -257,7 +257,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = 0; resid = hole_start; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break; @@ -276,7 +276,7 @@ check_content_dealloc(int fd, off_t hole_start, off_t hole_len, off_t shm_sz) offset = hole_start + hole_len; resid = shm_sz - offset; while (resid > 0) { - blen = resid < (off_t)page_size ? resid : page_size; + blen = resid < (off_t)page_size ? (size_t)resid : page_size; if (pread(fd, buf, blen, offset) != (ssize_t)blen) { error = 1; break; |