* [PATCH] read_file: Use read_full
@ 2014-02-13 9:12 Sascha Hauer
2014-02-17 10:04 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2014-02-13 9:12 UTC (permalink / raw)
To: barebox
At least NFS does not fulfill read requests > 1024 bytes at once.
Use read_full in read_file as read doesn't guarantee that the
whole request can be read at once.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/fs.c b/fs/fs.c
index 7a57bc0..eed0fce 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -60,7 +60,8 @@ again:
if (fd < 0)
goto err_out;
- if (read(fd, buf, s.st_size) < s.st_size)
+ ret = read_full(fd, buf, s.st_size);
+ if (ret < 0)
goto err_out1;
close(fd);
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-17 10:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 9:12 [PATCH] read_file: Use read_full Sascha Hauer
2014-02-17 10:04 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox