From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSjp-0002eS-Qn for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrSjd-0003Vu-HH for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSjd-0003VO-4Q for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:57:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s52Dv7sa016761 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 2 Jun 2014 09:57:08 -0400 From: Kevin Wolf Date: Mon, 2 Jun 2014 15:56:48 +0200 Message-Id: <1401717408-4607-18-git-send-email-kwolf@redhat.com> In-Reply-To: <1401717408-4607-1-git-send-email-kwolf@redhat.com> References: <1401717408-4607-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Max Reitz img_check() should report that the format of the given image does not support checks even if JSON output is desired. JSON data is output to stdout, as opposed to error messages, which are (in the case of qemu-img) printed to stderr. Therefore, it is easy to distinguish between the two. Also, img_info() does already use error_report() for human-readable messages even though JSON output is desired (through collect_image_info_list()). Signed-off-by: Max Reitz Reviewed-by: Markus Armbruster Signed-off-by: Kevin Wolf --- qemu-img.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index d118da5..b3d2bc6 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -663,9 +663,7 @@ static int img_check(int argc, char **argv) ret = collect_image_check(bs, check, filename, fmt, fix); if (ret == -ENOTSUP) { - if (output_format == OFORMAT_HUMAN) { - error_report("This image format does not support checks"); - } + error_report("This image format does not support checks"); ret = 63; goto fail; } -- 1.8.3.1