# Re: \[PATCH RESEND 2/2\] Input: uinput: Avoid returning 0 on read()

- From: David Herrmann \<hidden\>
- Date: 2012-03-31 08:39:50 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2012/03/8919189
- Thread: https://ratatoskr.run/linux-input/2012/03/8919164/t.md

```text
Hi Dmitry

On Sat, Mar 31, 2012 at 8:00 AM, Dmitry Torokhov
[ref] wrote:
> Hi David,
>
<snip>
> I agree that we should return -EINVAL when buffer is too small. I
> however do not like the whole "try_again" business; I think it is
> perfectly fine to return 0 for blocking reads, we just want to return
> -EAGAIN for nonblocking.

The read() manpage says that return-code 0 means the fd got closed.
Does the VFS layer forward the return-code untouched to user-space or
why do you think returning 0 is fine? At least my uinput user-space
apps handle read()==0 as failure.

> I changed around your patches a bit and will post them shortly.

Apart from the ret==0 issue I have nothing to object. If you want to
apply them the way they're now, I am ok with it, too. Thanks for
cleaning them up.

> Aristeu, since the patches changed somewhat I dropped your Acked-by so
> please Ack the patches you are comfortable with again.
>
> Thanks.
>
> --
> Dmitry

Thanks
David
```
