From 6756cd2cb2d06b6a75998ef6491265e45d49f198 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 8 Nov 2011 13:19:22 +0100 Subject: 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 --- fs/fs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fs') diff --git a/fs/fs.c b/fs/fs.c index 51a7411b69..56b822b6a0 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -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) -- cgit v1.2.3