Why is getentropy marked with warn_unused_result?

Paul Pluzhnikov ppluzhnikov@google.com
Sat Jul 22 23:12:00 GMT 2017


On Sat, Jul 22, 2017 at 2:14 PM, Florian Bruhin <me@the-compiler.org> wrote:

> Why is that, since it shouldn't fail under normal circumstances (at
> least that's what Qt's sources claim)?

If you didn't check the return value, how would you ever know whether
you got entropy or not?

The fact that something doesn't fail under normal conditions doesn't
absolve you from the need to check for abnormal conditions, especially
when dealing with random data that is likely to be used for crypto.

-- 
Paul Pluzhnikov



More information about the Libc-alpha mailing list