Fix bug in munmap_test

This commit is contained in:
Justine Tunney 2024-07-20 03:23:37 -07:00
parent 3374cbba73
commit 421a819d88
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -184,8 +184,8 @@ TEST(munmap, tinyFile_preciseUnmapSize) {
// clang-format off
TEST(munmap, tinyFile_mapThriceUnmapOnce) {
char *p;
ASSERT_NE(MAP_FAILED, (p = mmap(0, gransz*4, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)));
ASSERT_SYS(0, 0, munmap(p, gransz*4));
ASSERT_NE(MAP_FAILED, (p = mmap(0, gransz*5, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)));
ASSERT_SYS(0, 0, munmap(p, gransz*5));
ASSERT_SYS(0, 3, open("doge", O_RDWR | O_CREAT | O_TRUNC, 0644));
ASSERT_SYS (0, 5, write(3, "hello", 5));
ASSERT_EQ(p+gransz*0, mmap(p+gransz*0, gransz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0));