diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-02-05 14:39:34 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-02-05 14:39:34 +0000 |
| commit | a689bfa4e25af8307709dc12f75b0e02a65abf18 (patch) | |
| tree | 379363251827f19c22fd4eb518c59520da58bb1c /lib/libdiff | |
| parent | 8c40c7bb361f0c8b595bfee9dc6f8790e0eb6d68 (diff) | |
libdiff: Simplify truncation detection
* Adjust the comment to reflect the fact that SIGBUS can occur not only
if the file is truncated, but also if an I/O error occurs while paging
in any part of it.
* Instead of setting a flag, just return EIO.
* Adjust the unit test accordingly.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj, kevans
Differential Revision: https://reviews.freebsd.org/D55108
Diffstat (limited to 'lib/libdiff')
| -rw-r--r-- | lib/libdiff/tests/libdiff_test.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libdiff/tests/libdiff_test.c b/lib/libdiff/tests/libdiff_test.c index e82a36f3d38a..2a7c1b37e2c2 100644 --- a/lib/libdiff/tests/libdiff_test.c +++ b/lib/libdiff/tests/libdiff_test.c @@ -45,10 +45,9 @@ ATF_TC_BODY(diff_atomize_truncated, tc) rewind(f); ATF_REQUIRE(truncate(fn, size / 2) == 0); ATF_REQUIRE((p = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fileno(f), 0)) != MAP_FAILED); - ATF_REQUIRE(diff_atomize_file(&d, &cfg, f, p, size, 0) == 0); + ATF_REQUIRE(diff_atomize_file(&d, &cfg, f, p, size, 0) == EIO); ATF_REQUIRE((size_t)d.len <= size / 2); ATF_REQUIRE((size_t)d.len >= size / 2 - sizeof(line)); - ATF_REQUIRE(d.atomizer_flags & DIFF_ATOMIZER_FILE_TRUNCATED); } ATF_TC_CLEANUP(diff_atomize_truncated, tc) { |
