stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)

Using an unsigned type prevents the fallback to be used if kernel
does not support getrandom syscall.

Checked on x86_64-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
This commit is contained in:
Adhemerval Zanella 2022-09-29 16:15:20 -03:00
parent 8b10727a9a
commit 13db9ee2cb
2 changed files with 2 additions and 2 deletions

View file

@ -34,7 +34,7 @@ void
__arc4random_buf (void *p, size_t n) __arc4random_buf (void *p, size_t n)
{ {
static int seen_initialized; static int seen_initialized;
size_t l; ssize_t l;
int fd; int fd;
if (n == 0) if (n == 0)

View file

@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt); INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
} }
static inline int static inline ssize_t
__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
{ {
return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags); return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);