casaroli commented on code in PR #22068:
URL: https://github.com/apache/nuttx/pull/22068#discussion_r4634958389


##########
libs/libc/stdlib/lib_arc4random.c:
##########
@@ -42,26 +46,37 @@
 static int getrandom_all(FAR void *buf, size_t size, int flags)
 {
   FAR char *tmp = buf;
+  _NX_FILE file;
+  ssize_t nread;
+  int ret;
 
-  while (size > 0)
+  ret = _NX_FILE_OPEN(&file, (flags & GRND_RANDOM) != 0 ?
+                      "/dev/random" : "/dev/urandom", O_RDONLY, 0);
+  if (ret < 0)
     {
-      ssize_t ret = getrandom(tmp, size, flags);
+      return _NX_FILE_ERRVAL(ret);

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to