Re: [PATCH] Console: fall back to /dev/null when no console is availlable

Andries Brouwer
2004-10-05T22:36:28Z

On Tue, Oct 05, 2004 at 09:27:12PM +0100, Russell King wrote:
> On Tue, Oct 05, 2004 at 08:52:14PM +0200, Jörn Engel wrote:
> > Looks pretty trivial, but opinions on this subject may vary.
> > Comments?
>
> There's a related problem. /sbin/hotplug. I keep seeing odd failures
> from /sbin/hotplug scripts which go away when I ensure that fd0,1,2 are
> directed at something real.

Yes. In principle, user space must be able to handle the case
where no fds 0,1,2 are available. For example in mount.c:

while((fd = open("/dev/null", O_RDWR)) == 0 || fd == 1) ;
if (fd > 2)
close(fd);

or so.

Andries