This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[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."
- From: "ldv at sourceware dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 26 Oct 2017 16:58:30 +0000
- Subject: [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."
- Auto-submitted: auto-generated
- References: <bug-22347-131@http.sourceware.org/bugzilla/>
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.