Skip to content

Commit 090f859

Browse files
committed
Check errno on startup in timerfd__{reset_to_very_long,unmodified_errno}
Due to a bug in CheriBSD, errno was set non-zero when starting this test, but without these checks the test confusingly failed in the later check which made me think something was wrong in timerfd_create. Check errno on startup to make this more obvious. See CTSRD-CHERI/cheribsd#1424
1 parent 86d269e commit 090f859

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/timerfd-test.c

+3
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__short_evfilt_timer_timeout, tc)
900900
ATF_TC_WITHOUT_HEAD(timerfd__unmodified_errno);
901901
ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
902902
{
903+
ATF_REQUIRE(errno == 0);
903904
int timerfd = timerfd_create(CLOCK_MONOTONIC, /**/
904905
TFD_CLOEXEC | TFD_NONBLOCK);
905906
ATF_REQUIRE(timerfd >= 0);
@@ -911,6 +912,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
911912
.it_value.tv_nsec = 100000000,
912913
},
913914
NULL) == 0);
915+
ATF_REQUIRE(errno == 0);
914916
(void)wait_for_timerfd(timerfd);
915917
ATF_REQUIRE(errno == 0);
916918

@@ -937,6 +939,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
937939
ATF_TC_WITHOUT_HEAD(timerfd__reset_to_very_long);
938940
ATF_TC_BODY_FD_LEAKCHECK(timerfd__reset_to_very_long, tc)
939941
{
942+
ATF_REQUIRE(errno == 0);
940943
int timerfd = timerfd_create(CLOCK_MONOTONIC, /**/
941944
TFD_CLOEXEC | TFD_NONBLOCK);
942945
ATF_REQUIRE(timerfd >= 0);

0 commit comments

Comments
 (0)