From: Matthew Daley Date: Wed, 30 Oct 2013 07:51:41 +0000 (+1300) Subject: libxc: tidy up loop construct in write_compressed X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6107 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fcaacad1a472f3023a7fd9cea4132c3f6533c913;p=xen.git libxc: tidy up loop construct in write_compressed ...otherwise the return 0 at the bottom is dead code. Coverity-ID: 1055189 Signed-off-by: Matthew Daley Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 673d1e91ff..42c475252e 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -233,7 +233,7 @@ static int write_compressed(xc_interface *xch, comp_ctx *compress_ctx, int marker = XC_SAVE_ID_COMPRESSED_DATA; unsigned long compbuf_len = 0; - do + for(;;) { /* check for available space (atleast 8k) */ if ((ob->pos + header + XC_PAGE_SIZE * 2) > ob->size) @@ -250,7 +250,7 @@ static int write_compressed(xc_interface *xch, comp_ctx *compress_ctx, ob->size - ob->pos - header, &compbuf_len); if (!rc) - return 0; + break; if (outbuf_hardwrite(xch, ob, fd, &marker, sizeof(marker)) < 0) { @@ -270,7 +270,7 @@ static int write_compressed(xc_interface *xch, comp_ctx *compress_ctx, ERROR("Error when writing compressed chunk"); return -1; } - } while (rc != 0); + } return 0; }