Author: dchagin
Date: Sun Jun 11 09:33:09 2017
New Revision: 319823
URL: https://svnweb.freebsd.org/changeset/base/319823

Log:
  MFC r319571:
  
  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
  Approved by:  re (kib)

Modified:
  stable/11/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/11/sys/compat/linux/linux_misc.c     Sun Jun 11 04:03:09 2017        
(r319822)
+++ stable/11/sys/compat/linux/linux_misc.c     Sun Jun 11 09:33:09 2017        
(r319823)
@@ -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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to