On Wed, Sep 25, 2019 at 04:32:45PM +0200, Laslo Hunhold wrote: > please excuse the ignorant question, but why would you want to access > /dev/null? The problem with /dev/urandom is well-known, which is why > OpenBSD has arc4random(3). >
You might not, but a library you use might. I remember musl testing for open FDs 0, 1, and 2 and opening /dev/null to make up for missing FDs. And crashing (deliberately) if that fails. But then, that only happens for elevated security contexts, i.e. setuid or "secure" mode (which on Linux means "file capabilities set"). /dev/null has the distinction of being the only device POSIX actually requires. I don't know what you might use it for. (/dev/tty is defined, but optional.) Ciao, Markus