On success, getrandom() Linux system call returns the number of bytes that
were copied to the buffer supplied by the user. PR: 219464 Submitted by: Maciej Pasternacki Reported by: Maciej Pasternacki MFC after: 1 week
This commit is contained in:
@@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getrandom_args *args)
|
||||
{
|
||||
struct uio uio;
|
||||
struct iovec iov;
|
||||
int error;
|
||||
|
||||
if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM))
|
||||
return (EINVAL);
|
||||
@@ -2532,7 +2533,10 @@ linux_getrandom(struct thread *td, struct linux_getrandom_args *args)
|
||||
uio.uio_rw = UIO_READ;
|
||||
uio.uio_td = td;
|
||||
|
||||
return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK));
|
||||
error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK);
|
||||
if (error == 0)
|
||||
td->td_retval[0] = args->count - uio.uio_resid;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user