Skip to contentSkip to conversation

UBI-Utils: ubimirror discards returncode

PATCH In review Alexander Schmidt 2 participants 2 messages Jun 29, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UBI-Utils: ubimirror discards returncode

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.

---
 ubi-utils/src/libubimirror.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
ubi-utils/src/libubimirror.c +7 -5
@@ -190,11 +190,13 @@ int ubimirror(uint32_t devno, int seqnum
 		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]);
#1 lore raw
Quoted 7 lines · Alexander Schmidt

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.

Thanks.