[PATCH] read_file: Use read_full

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 13 04:12:53 EST 2014


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 at 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




More information about the barebox mailing list