summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-11-08 13:19:22 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-09 11:23:16 +0100
commit6756cd2cb2d06b6a75998ef6491265e45d49f198 (patch)
tree7465951ec303b31427e6323f1c19d657667345f0 /fs
parentd471e8549e81728e981ae33e302d11b55322d314 (diff)
downloadbarebox-6756cd2cb2d06b6a75998ef6491265e45d49f198.tar.gz
barebox-6756cd2cb2d06b6a75998ef6491265e45d49f198.tar.xz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c4
1 files changed, 4 insertions, 0 deletions
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)