From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Aneesh Kumar K.V" Subject: Re: [PATCH] kvm tools: Plug warning in virtio_p9_wstat() Date: Sun, 10 Jul 2011 22:53:39 +0530 Message-ID: <87vcvaoxr8.fsf@linux.vnet.ibm.com> References: <20110710120113.32717.40442.stgit@localhost6> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Asias He , Sasha Levin To: Pekka Enberg , Konstantin Khlebnikov Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:56478 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756011Ab1GJRY3 convert rfc822-to-8bit (ORCPT ); Sun, 10 Jul 2011 13:24:29 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p6AGtpZ3013561 for ; Sun, 10 Jul 2011 12:55:51 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6AHOSZq135054 for ; Sun, 10 Jul 2011 13:24:28 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6AHOSfJ030649 for ; Sun, 10 Jul 2011 13:24:28 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 10 Jul 2011 15:18:41 +0300, Pekka Enberg w= rote: > On Sun, Jul 10, 2011 at 3:01 PM, Konstantin Khlebnikov > wrote: > > glibc declare ftruncate() with attribute warn_unused_result, so res= ult must be "checked", otherwise we get: > > > > virtio/9p.c:487:6: error: variable =E2=80=98res=E2=80=99 set but no= t used [-Werror=3Dunused-but-set-variable] > > or > > virtio/9p.c:496:12: error: ignoring return value of =E2=80=98ftrunc= ate=E2=80=99, declared with attribute warn_unused_result [-Werror=3Dunu= sed-result] > > > > Signed-off-by: Konstantin Khlebnikov > > --- > > =C2=A0tools/kvm/virtio/9p.c | =C2=A0 =C2=A01 + > > =C2=A01 files changed, 1 insertions(+), 0 deletions(-) > > > > diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c > > index d927688..4586f66 100644 > > --- a/tools/kvm/virtio/9p.c > > +++ b/tools/kvm/virtio/9p.c > > @@ -495,6 +495,7 @@ static void virtio_p9_wstat(struct p9_dev *p9de= v, > > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (wstat.length !=3D -1UL) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0res =3D ftru= ncate(fid->fd, wstat.length); > > + =C2=A0 =C2=A0 =C2=A0 (void)res; /* To plug the warning. FIXME wha= t if ftruncate fails? */ >=20 > There's a >=20 > make WERROR=3D0 >=20 > to work around the warning. Sasha, Aneesh, shouldn't we propagate an > error to the guest here? >=20 Yes we should. We should do an RERROR message to the guest. I guess other functions in 9p.c is also missing error handling. -aneesh