X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fubi.c;h=ac9a582437d603039ec722db30d32187dd1181c4;hb=e705e2cd5b153af8dcdc43854693cea616cd41d0;hp=222be5a3576cb7aa96121b449889766550d1885d;hpb=9a1d64809d51ddae40fe7802da18e8069f11cb43;p=u-boot diff --git a/cmd/ubi.c b/cmd/ubi.c index 222be5a357..ac9a582437 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; }