sound tests: Check the return value of close(2)

While here, remove two munmap(2) calls on mappings the tests require to
have failed, since they are practically dead.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D60800
This commit is contained in:
Christos Margiolis committed 2026-10-27 12:27:32 +01:00
1 parent 5760c22a05
commit eb36c35ccf
3 files changed
+9 -13

No files matched your search

+2 -6
View File
@@ -40,9 +40,7 @@ ATF_TC_BODY(mmap_offset_overflow, tc)
buf = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, off);
ATF_REQUIRE_MSG(buf == MAP_FAILED, FMT_ERR("mmap"));
munmap(buf, len);
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
/*
@@ -124,9 +122,7 @@ ATF_TC_BODY(mmap_reject_prot_exec, tc)
fd, 0);
ATF_REQUIRE_MSG(buf == MAP_FAILED, FMT_ERR("mmap"));
munmap(buf, len);
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
/*
+5 -5
View File
@@ -98,7 +98,7 @@ ATF_TC_BODY(poll_kqueue, tc)
ATF_REQUIRE_MSG(read(fd, buf, sizeof(buf)) > 0, FMT_ERR("read"));
EV_SET(&ev, fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
close(kq);
ATF_REQUIRE(close(kq) == 0);
kq = kqueue();
ATF_REQUIRE_MSG(kq >= 0, FMT_ERR("kqueue"));
@@ -113,9 +113,9 @@ ATF_TC_BODY(poll_kqueue, tc)
ATF_REQUIRE_MSG(write(fd, buf, sizeof(buf)) > 0, FMT_ERR("write"));
EV_SET(&ev, fd, EVFILT_WRITE, EV_DELETE, 0, 0, 0);
close(kq);
ATF_REQUIRE(close(kq) == 0);
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
ATF_TC(poll_poll);
@@ -154,7 +154,7 @@ ATF_TC_BODY(poll_poll, tc)
wr = true;
}
}
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
ATF_TC(poll_select);
@@ -192,7 +192,7 @@ ATF_TC_BODY(poll_select, tc)
wr = true;
}
}
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
ATF_TP_ADD_TCS(tp)
+2 -2
View File
@@ -196,7 +196,7 @@ ATF_TC_BODY(sndstat_nv, tc)
free(arg.buf);
nvlist_destroy(nvl);
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
#define UDEV_PROVIDER "sndstat_udev"
@@ -374,7 +374,7 @@ ATF_TC_BODY(sndstat_udev, tc)
free(arg.buf);
nvlist_destroy(nvl);
close(fd);
ATF_REQUIRE(close(fd) == 0);
}
ATF_TP_ADD_TCS(tp)