From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9yMe-00005o-Nq for qemu-devel@nongnu.org; Fri, 07 Sep 2012 09:13:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9yMc-0007ek-52 for qemu-devel@nongnu.org; Fri, 07 Sep 2012 09:12:52 -0400 Message-ID: <5049F2CD.9010809@redhat.com> Date: Fri, 07 Sep 2012 15:12:45 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1346851493-9149-1-git-send-email-riegamaths@gmail.com> In-Reply-To: <1346851493-9149-1-git-send-email-riegamaths@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: riegamaths@gmail.com Cc: qemu-trivial , qemu-devel Am 05.09.2012 15:24, schrieb riegamaths@gmail.com: > From: Dunrong Huang >=20 > If we failed to create temporary snapshot, the error message did not ma= tch > with the error, for example: >=20 > $ TMPDIR=3D/tmp/bad_path qemu-system-x86_64 -enable-kvm debian.qcow2 -s= napshot > qemu-system-x86_64: -enable-kvm: could not open disk image /home/mathsl= inux/Images/debian.qcow2: No such file or directory >=20 > Indeed, the file which cant be created is /tmp/bad_path/vl.xxxxxx, not > debian.qcow2. so the error message makes users feel confused. >=20 > Signed-off-by: Dunrong Huang > --- > v1 -> v2: > Output error message only if fd < 0 > v2 -> v3: > Output error message in the caller of get_tmp_filename() > block.c | 2 ++ > 1 =E4=B8=AA=E6=96=87=E4=BB=B6=E8=A2=AB=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8F= =92=E5=85=A5 2 =E8=A1=8C(+) >=20 > diff --git a/block.c b/block.c > index 470bdcc..074987e 100644 > --- a/block.c > +++ b/block.c > @@ -764,6 +764,8 @@ int bdrv_open(BlockDriverState *bs, const char *fil= ename, int flags, > =20 > ret =3D get_tmp_filename(tmp_filename, sizeof(tmp_filename)); > if (ret < 0) { > + fprintf(stderr, "Could not create temporary snapshot %s: %= s\n", > + tmp_filename, strerror(errno)); This should be strerror(-ret). Also consider using error_report() instead of fprintf(). > return ret; > } > =20 Kevin