The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c5056a3931b41a803a24b89400d38d5c5f843612

commit c5056a3931b41a803a24b89400d38d5c5f843612
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2025-01-19 16:17:05 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2025-01-19 16:17:05 +0000

    getentropy tests: Update after commit 473681a1a506da
    
    - Use GETENTROPY_MAX instead of hard-coding the value.
    - Check for EINVAL instead of EIO
    
    Fixes:  473681a1a506 ("libc: Fix getentropy POSIX 2024 conformance issues")
---
 lib/libc/tests/gen/getentropy_test.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/libc/tests/gen/getentropy_test.c 
b/lib/libc/tests/gen/getentropy_test.c
index 156d3a94a7de..6ac9d5678ea6 100644
--- a/lib/libc/tests/gen/getentropy_test.c
+++ b/lib/libc/tests/gen/getentropy_test.c
@@ -28,6 +28,7 @@
 
 #include <sys/param.h>
 #include <errno.h>
+#include <limits.h>
 #include <signal.h>
 #include <unistd.h>
 
@@ -62,13 +63,13 @@ ATF_TC_BODY(getentropy_sizes, tc)
        char buf[512];
 
        ATF_REQUIRE_EQ(getentropy(buf, sizeof(buf)), -1);
-       ATF_REQUIRE_EQ(errno, EIO);
-       ATF_REQUIRE_EQ(getentropy(buf, 257), -1);
-       ATF_REQUIRE_EQ(errno, EIO);
+       ATF_REQUIRE_EQ(errno, EINVAL);
+       ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX + 1), -1);
+       ATF_REQUIRE_EQ(errno, EINVAL);
 
        /* Smaller sizes always succeed: */
-       ATF_REQUIRE_EQ(getentropy(buf, 256), 0);
-       ATF_REQUIRE_EQ(getentropy(buf, 128), 0);
+       ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX), 0);
+       ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX / 2), 0);
        ATF_REQUIRE_EQ(getentropy(buf, 0), 0);
 }
 

Reply via email to