This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/22347] getrandom() returns the number of bytes that were copied to the buffer even though the comments say "Return 0 on success and -1 on failure."


https://sourceware.org/bugzilla/show_bug.cgi?id=22347

Dmitry V. Levin <ldv at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ldv at sourceware dot org

--- Comment #1 from Dmitry V. Levin <ldv at sourceware dot org> ---
(In reply to Eero Vuojolahti from comment #0)
> This is the current comment on line 25 sysdeps/unix/sysv/linux/getrandom.c:
> 
> /* Write LENGTH bytes of randomness starting at BUFFER.  Return 0 on
>    success and -1 on failure.  */
> 
> It could be changed to:
> 
> /* Write LENGTH bytes of randomness starting at BUFFER.  Return number of
>    bytes that were copied to the BUFFER on success and -1 on failure.  */

Note that a similar comment in the stub implementation stdlib/getrandom.c
doesn't have this bug.  Both comments are not quite correct about LENGTH,
though: they should say "Write up to LENGTH bytes" rather than "Write LENGTH
bytes".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]