9
0
Fork 0

fs: read: do not call read op when count is 0

Some ops do not handle read with count = 0 correctly. They do
not have to if this is catched in the upper layer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-11-08 13:19:22 +01:00
parent d471e8549e
commit 6756cd2cb2
1 changed files with 4 additions and 0 deletions

View File

@ -503,6 +503,10 @@ int read(int fd, void *buf, size_t count)
if (f->pos + count > f->size)
count = f->size - f->pos;
if (!count)
return 0;
errno = fsdrv->read(dev, f, buf, count);
if (errno > 0)