O_NONBLOCK on stdin left set by child (using ash shell)

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 10 17:41:54 UTC 2009


On Tue, Nov 10, 2009 at 5:43 PM, Johns Daniel <johns.daniel at gmail.com> wrote:
> We just upgraded to BusyBox v1.14.4 (w/ built-in ash shell),

...where ash got a workaround to not require O_NONBLOCK
to be cleared on stdin (it used to reset it)...

> and we
> have noticed what seems to be a bug.

Yes, this is a design bug *in Unix API*. O_NONBLOCK had to be
a flag associated with a file descriptor, not a file,
like FD_CLOEXEC.

Or it should be possible to use recv(fd, buf, size, MSG_DONTWAIT)
on non-sockets.

> When we exit from one of our user apps that sets stdin to O_NONBLOCK,
> O_NONBLOCK remains set on stdin in the shell. So, any subsequent app
> not expecting O_NONBLOCK on stdin gets an unexpected EAGAIN. For
> example,

How ash can know that it was not your *intention* to switch
O_NONBLOCK ob by one app and use it by other app?

--
vda


More information about the busybox mailing list