svn commit: r319571 - head/sys/compat/linux
Dmitry Chagin
dchagin at FreeBSD.org
Sun Jun 4 18:35:31 UTC 2017
Author: dchagin
Date: Sun Jun 4 18:35:30 2017
New Revision: 319571
URL: https://svnweb.freebsd.org/changeset/base/319571
Log:
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
Modified:
head/sys/compat/linux/linux_misc.c
Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c Sun Jun 4 18:24:41 2017 (r319570)
+++ head/sys/compat/linux/linux_misc.c Sun Jun 4 18:35:30 2017 (r319571)
@@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getran
{
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_getran
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
More information about the svn-src-head
mailing list