Skip to content
Snippets Groups Projects
Commit 7a3e70cf authored by Max Krummenacher's avatar Max Krummenacher Committed by Tom Rini
Browse files

fs/fs.c: read up to EOF when len would read past EOF

http://lists.denx.de/pipermail/u-boot/2012-September/134347.html


allows for reading files in chunks from the shell.

When this feature is used to read past the end of a file an error
was returned instead of returning the bytes read up to the end of
file. Thus the following fails in the shell:

offset = 0
len = chunksize
do
	read file, offset, len
	write data
until bytes_read < len

The patch changes the behaviour to printing an informational
message and returning the actual read number of bytes aka read(2)
behaviour for convenient use in U-Boot scripts.

Signed-off-by: default avatarMax Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarStefan Agner <stefan.agner@toradex.com>
Signed-off-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
parent f06b454b
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment