aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini2017-09-15 08:45:21 -0400
committerTom Rini2017-09-15 08:45:21 -0400
commit1c7b5d0309c1da3952b1236d42c82c5ea8446476 (patch)
tree5af58261320407eb1b8f927d56327fc6eab00c09
parentc9772268408f7c8314cfe3fbe38b168ea770c8de (diff)
parent985fa93e61706a78fad130b006aefa1c098145de (diff)
Merge git://git.denx.de/u-boot-ubi
-rw-r--r--cmd/ubi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 222be5a3576..ac9a582437d 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
unsigned long long tmp;
struct ubi_volume *vol;
loff_t offp = 0;
+ size_t len_read;
vol = ubi_find_volume(volume);
if (vol == NULL)
@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
tmp = offp;
off = do_div(tmp, vol->usable_leb_size);
lnum = tmp;
+ len_read = size;
do {
if (off + len >= vol->usable_leb_size)
len = vol->usable_leb_size - off;
@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
len = size > tbuf_size ? tbuf_size : size;
} while (size);
+ if (!size)
+ env_set_hex("filesize", len_read);
+
free(tbuf);
return err;
}