[COMMITTED] stdlib: Fix tst-getrandom memcmp call

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Mar 31 12:15:48 GMT 2022


The idea is to check if the up sizeof (buf) are equal, not only
the first byte.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 stdlib/tst-getrandom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stdlib/tst-getrandom.c b/stdlib/tst-getrandom.c
index 608fc4746e..61c3cae92e 100644
--- a/stdlib/tst-getrandom.c
+++ b/stdlib/tst-getrandom.c
@@ -189,7 +189,7 @@ test_getentropy (void)
 
   /* The probability that these two buffers are equal is very
      small. */
-  if (memcmp (buf, buf2, sizeof (buf) == 0))
+  if (memcmp (buf, buf2, sizeof (buf)) == 0)
     {
       printf ("error: getentropy appears to return constant bytes\n");
       errors = true;
-- 
2.32.0



More information about the Libc-alpha mailing list