From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNBfh-0002l9-2Q for qemu-devel@nongnu.org; Tue, 22 Dec 2009 15:49:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNBfc-0002hT-Qa for qemu-devel@nongnu.org; Tue, 22 Dec 2009 15:49:32 -0500 Received: from [199.232.76.173] (port=43386 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNBfc-0002hH-MJ for qemu-devel@nongnu.org; Tue, 22 Dec 2009 15:49:28 -0500 Received: from mail-yw0-f171.google.com ([209.85.211.171]:33633) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNBfc-00046F-7a for qemu-devel@nongnu.org; Tue, 22 Dec 2009 15:49:28 -0500 Received: by ywh1 with SMTP id 1so6158888ywh.18 for ; Tue, 22 Dec 2009 12:49:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1261273167-3240-17-git-send-email-kirill@shutemov.name> References: <1261273167-3240-1-git-send-email-kirill@shutemov.name> <1261273167-3240-9-git-send-email-kirill@shutemov.name> <1261273167-3240-10-git-send-email-kirill@shutemov.name> <1261273167-3240-11-git-send-email-kirill@shutemov.name> <1261273167-3240-12-git-send-email-kirill@shutemov.name> <1261273167-3240-13-git-send-email-kirill@shutemov.name> <1261273167-3240-14-git-send-email-kirill@shutemov.name> <1261273167-3240-15-git-send-email-kirill@shutemov.name> <1261273167-3240-16-git-send-email-kirill@shutemov.name> <1261273167-3240-17-git-send-email-kirill@shutemov.name> From: Blue Swirl Date: Tue, 22 Dec 2009 20:49:07 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 17/18] path.c fix warning with _FORTIFY_SOURCE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Kirill A. Shutemov" Cc: qemu-devel@nongnu.org On Sun, Dec 20, 2009 at 1:39 AM, Kirill A. Shutemov wrote: > =C2=A0CC =C2=A0 =C2=A0libuser/path.o > cc1: warnings being treated as errors > /usr/src/RPM/BUILD/qemu-0.11.92/path.c: In function 'new_entry': > /usr/src/RPM/BUILD/qemu-0.11.92/path.c:49: error: ignoring return value o= f 'asprintf', declared with attribute warn_unused_result > make[1]: *** [path.o] Error 1 > > Signed-off-by: Kirill A. Shutemov > --- > =C2=A0path.c | =C2=A0 =C2=A05 ++++- > =C2=A01 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/path.c b/path.c > index cc9e007..0d2bf14 100644 > --- a/path.c > +++ b/path.c > @@ -46,7 +46,10 @@ static struct pathelem *new_entry(const char *root, > =C2=A0{ > =C2=A0 =C2=A0 struct pathelem *new =3D malloc(sizeof(*new)); > =C2=A0 =C2=A0 new->name =3D strdup(name); > - =C2=A0 =C2=A0asprintf(&new->pathname, "%s/%s", root, name); > + =C2=A0 =C2=A0if (asprintf(&new->pathname, "%s/%s", root, name) =3D=3D -= 1) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("Cannot allocate memory\n"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0exit(1); > + =C2=A0 =C2=A0} > =C2=A0 =C2=A0 new->num_entries =3D 0; > =C2=A0 =C2=A0 return new; > =C2=A0} Looks OK.