summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-06-27 19:21:28 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-06-27 19:21:28 +0300
commit230b13b2d9b109b5c166b4b0334609b52b452d12 (patch)
tree7c6346a1eb78311e1416280380559e317e613ca4
parent8ec6531393464519a9d2720c27be200d226c21fb (diff)
ubiupdatevol: minor tweakv1.2.0
Undo my weird change which slipped accidentally to the commit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--ubi-utils/new-utils/src/ubiupdatevol.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ubi-utils/new-utils/src/ubiupdatevol.c b/ubi-utils/new-utils/src/ubiupdatevol.c
index dcedd66..404bfa0 100644
--- a/ubi-utils/new-utils/src/ubiupdatevol.c
+++ b/ubi-utils/new-utils/src/ubiupdatevol.c
@@ -215,11 +215,10 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
int err, fd, ifd;
long long bytes;
char *buf;
- int leb_size = vol_info->leb_size;
- buf = malloc(leb_size);
+ buf = malloc(vol_info->leb_size);
if (!buf)
- return errmsg("cannot allocate %d bytes of memory", leb_size);
+ return errmsg("cannot allocate %d bytes of memory", vol_info->leb_size);
if (!args.size) {
struct stat st;
@@ -266,19 +265,19 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
}
while (bytes) {
- int ret;
+ int ret, to_copy = vol_info->leb_size;
- if (leb_size > bytes)
- leb_size = bytes;
+ if (to_copy > bytes)
+ to_copy = bytes;
- ret = read(ifd, buf, leb_size);
+ ret = read(ifd, buf, to_copy);
if (ret <= 0) {
if (errno == EINTR) {
warnmsg("do not interrupt me!");
continue;
} else {
sys_errmsg("cannot read %d bytes from \"%s\"",
- leb_size, args.img);
+ to_copy, args.img);
goto out_close;
}
}