]> www.infradead.org Git - mtd-utils.git/commitdiff
ubiupdatevol: minor tweak v1.2.0
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 27 Jun 2008 16:21:28 +0000 (19:21 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 27 Jun 2008 16:21:28 +0000 (19:21 +0300)
Undo my weird change which slipped accidentally to the commit.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/new-utils/src/ubiupdatevol.c

index dcedd66b879d51684bc7f65b2b7830527cebab3c..404bfa0854a07113d15c2209dc4386afbf7a4f29 100644 (file)
@@ -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;
                        }
                }