Skip to content
Snippets Groups Projects
Commit 1c7b5d03 authored by Tom Rini's avatar Tom Rini
Browse files
parents c9772268 985fa93e
No related branches found
No related tags found
No related merge requests found
...@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size) ...@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
unsigned long long tmp; unsigned long long tmp;
struct ubi_volume *vol; struct ubi_volume *vol;
loff_t offp = 0; loff_t offp = 0;
size_t len_read;
vol = ubi_find_volume(volume); vol = ubi_find_volume(volume);
if (vol == NULL) if (vol == NULL)
...@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size) ...@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
tmp = offp; tmp = offp;
off = do_div(tmp, vol->usable_leb_size); off = do_div(tmp, vol->usable_leb_size);
lnum = tmp; lnum = tmp;
len_read = size;
do { do {
if (off + len >= vol->usable_leb_size) if (off + len >= vol->usable_leb_size)
len = vol->usable_leb_size - off; len = vol->usable_leb_size - off;
...@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size) ...@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
len = size > tbuf_size ? tbuf_size : size; len = size > tbuf_size ? tbuf_size : size;
} while (size); } while (size);
if (!size)
env_set_hex("filesize", len_read);
free(tbuf); free(tbuf);
return err; return err;
} }
......
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