Skip to content

Commit

Permalink
block: failed qemu-img command should return non-zero exit code
Browse files Browse the repository at this point in the history
If the backing file cannot be opened when doing qemu-img rebase, the
variable 'ret' was not assigned a non-zero value, and the qemu-img
process terminated with exit code zero. Fix this.

Signed-off-by: Xu Tian <xutian@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
Xu Tian authored and kevmw committed Oct 24, 2016
1 parent a3ae21e commit e84a0dd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qemu-img.c
Expand Up @@ -2956,6 +2956,7 @@ static int img_rebase(int argc, char **argv)
error_reportf_err(local_err,
"Could not open old backing file '%s': ",
backing_name);
ret = -1;
goto out;
}

Expand All @@ -2973,6 +2974,7 @@ static int img_rebase(int argc, char **argv)
error_reportf_err(local_err,
"Could not open new backing file '%s': ",
out_baseimg);
ret = -1;
goto out;
}
}
Expand Down

0 comments on commit e84a0dd

Please sign in to comment.