From: Alexander Schmidt Date: Fri, 29 Jun 2007 10:46:11 +0000 (+0200) Subject: UBI-Utils: ubimirror discards returncode X-Git-Tag: v1.1.0~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8496f75b4897056a1423e30a41649dbc11b421d4;p=mtd-utils.git 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. Signed-off-by: Alexander Schmidt Signed-off-by: Artem Bityutskiy --- diff --git a/ubi-utils/src/libubimirror.c b/ubi-utils/src/libubimirror.c index 2197260..e85f65d 100644 --- a/ubi-utils/src/libubimirror.c +++ b/ubi-utils/src/libubimirror.c @@ -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]);