From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmpgM-0004KQ-NO for qemu-devel@nongnu.org; Wed, 03 Mar 2010 09:36:14 -0500 Received: from [199.232.76.173] (port=53856 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmpgM-0004KI-BZ for qemu-devel@nongnu.org; Wed, 03 Mar 2010 09:36:14 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmpgL-0005J9-KC for qemu-devel@nongnu.org; Wed, 03 Mar 2010 09:36:14 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:39059) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmpgL-0005J1-Ae for qemu-devel@nongnu.org; Wed, 03 Mar 2010 09:36:13 -0500 Received: by ewy19 with SMTP id 19so1458693ewy.2 for ; Wed, 03 Mar 2010 06:36:11 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4B8E73D4.4090205@redhat.com> Date: Wed, 03 Mar 2010 15:36:04 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <92764ba73c7a75e8747b7a5a58a4a1ccb3d51489.1267617582.git.quintela@redhat.com> <4B8E6BB2.7040606@redhat.com> In-Reply-To: <4B8E6BB2.7040606@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 10/10] block: print errno on error List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: amit.shah@redhat.com, qemu-devel@nongnu.org, Juan Quintela >> diff --git a/qemu-img.c b/qemu-img.c >> index 0c9f2d4..f6c40fb 100644 >> --- a/qemu-img.c >> +++ b/qemu-img.c >> @@ -374,7 +374,7 @@ static int img_create(int argc, char **argv) >> } else if (ret == -EFBIG) { >> error("The image size is too large for file format '%s'", fmt); >> } else { >> - error("Error while formatting"); >> + error("Error (%s) while formatting for file format '%s'", strerror(ret), fmt); >> } >> } >> return 0; >> @@ -687,7 +687,7 @@ static int img_convert(int argc, char **argv) >> } else if (ret == -EFBIG) { >> error("The image size is too large for file format '%s'", out_fmt); >> } else { >> - error("Error while formatting '%s'", out_filename); >> + error("Error (%s) while formatting file '%s'", strerror(ret), out_filename); >> } >> } >> > > I think it should be strerror(-ret) in both cases. Yes; also, since you are at it, I think that respectively error("%s: error while creating %s image: %s", filename, fmt, strerror(-ret); error(%s: error while converting to %s: %s", out_filename, fmt, strerror(-ret); would be more consistent with usual error messages: $ cat fdsfds cat: fdsfds: No such file or directory Paolo