]> www.infradead.org Git - mtd-utils.git/commitdiff
UBI-Utils: ubimirror discards returncode
authorAlexander Schmidt <alexs@linux.vnet.ibm.com>
Fri, 29 Jun 2007 10:46:11 +0000 (12:46 +0200)
committerArtem Bityutskiy <dedekind@infradead.org>
Fri, 29 Jun 2007 11:48:37 +0000 (07:48 -0400)
Ubimirror compares volumes before they are mirrored, but discards the
result of the comparison and alway copies volumes.

I've tested this code with equal and unequal volumes and it seems to work
fine now.

Signed-off-by: Alexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
ubi-utils/src/libubimirror.c

index 21972602e502e0e49a85047775f68f25aa6626fd..e85f65d077536c813b41c999d3c33eab47fb1ab3 100644 (file)
@@ -190,11 +190,13 @@ int ubimirror(uint32_t devno, int seqnum, uint32_t *ids, ssize_t ids_size,
                if (rc < 0) {
                        EBUF("compare error volume %d and %d", src_id, ids[i]);
                        goto err;
-               }
-               rc = copy_files(fd_in, fd_out);
-               if (rc != 0) {
-                       EBUF("mirror error volume %d to %d", src_id, ids[i]);
-                       goto err;
+               } else if (rc == compare_different) {
+                       rc = copy_files(fd_in, fd_out);
+                       if (rc != 0) {
+                               EBUF("mirror error volume %d to %d", src_id,
+                                               ids[i]);
+                               goto err;
+                       }
                }
                if ((rc = ubi_vol_close(fd_out)) == -1) {
                        EBUF("close error volume %d", ids[i]);