From 574cf7b59f295bc4000fc7fbe01213bb6c7ea93a Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 1 Mar 2021 11:43:22 +0100 Subject: [PATCH] Clarify how a file descriptor could still be more than the limit It can happen if the file descriptor was opened before lowering the limit. Signed-off-by: Gilles Peskine --- tests/suites/test_suite_net.function | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/suites/test_suite_net.function b/tests/suites/test_suite_net.function index 111a34950..f429fc922 100644 --- a/tests/suites/test_suite_net.function +++ b/tests/suites/test_suite_net.function @@ -94,6 +94,10 @@ void poll_beyond_fd_setsize( ) * If the limit can't be raised, a file descriptor opened by the * net_sockets module will be less than FD_SETSIZE, so the test * is not necessary and we mark it as skipped. + * A file descriptor could still be higher than FD_SETSIZE if it was + * opened before the limit was lowered (which is something an application + * might do); but we don't do such things in our test code, so the unit + * test will run if it can. */ TEST_ASSERT( getrlimit( RLIMIT_NOFILE, &rlim_nofile ) == 0 ); if( rlim_nofile.rlim_cur < FD_SETSIZE + 1 )