From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQtR4-0006hg-Li for qemu-devel@nongnu.org; Fri, 01 Jan 2010 21:09:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQtR0-0006hA-Uz for qemu-devel@nongnu.org; Fri, 01 Jan 2010 21:09:46 -0500 Received: from [199.232.76.173] (port=38224 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQtR0-0006h7-P1 for qemu-devel@nongnu.org; Fri, 01 Jan 2010 21:09:42 -0500 Received: from mail-gx0-f223.google.com ([209.85.217.223]:51473) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQtR0-0001dw-DW for qemu-devel@nongnu.org; Fri, 01 Jan 2010 21:09:42 -0500 Received: by gxk23 with SMTP id 23so15121949gxk.2 for ; Fri, 01 Jan 2010 18:09:41 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <87oclfa03j.fsf@lechat.rtp-net.org> References: <1262223266-19191-1-git-send-email-kirill@shutemov.name> <1262223266-19191-2-git-send-email-kirill@shutemov.name> <1262223266-19191-3-git-send-email-kirill@shutemov.name> <87oclfa03j.fsf@lechat.rtp-net.org> Date: Sat, 2 Jan 2010 04:09:41 +0200 Message-ID: Subject: Re: [Qemu-devel] [PATCH 12/14] linux-user/mmap.c: fix warnings with _FORTIFY_SOURCE From: "Kirill A. Shutemov" 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: Arnaud Patard Cc: qemu-devel@nongnu.org On Thu, Dec 31, 2009 at 12:50 PM, Arnaud Patard wrote: > "Kirill A. Shutemov" writes: > > Hi, > >> =C2=A0 CC =C2=A0 =C2=A0i386-linux-user/mmap.o >> cc1: warnings being treated as errors >> /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'mmap_fra= g': >> /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:253: error: ignoring r= eturn value of 'pread', declared with attribute warn_unused_result >> /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'target_m= map': >> /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:477: error: ignoring r= eturn value of 'pread', declared with attribute warn_unused_result >> make[1]: *** [mmap.o] Error 1 >> >> Signed-off-by: Kirill A. Shutemov >> --- >> =C2=A0linux-user/mmap.c | =C2=A0 =C2=A06 ++++-- >> =C2=A01 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/linux-user/mmap.c b/linux-user/mmap.c >> index 144fb7c..e496c64 100644 >> --- a/linux-user/mmap.c >> +++ b/linux-user/mmap.c >> @@ -250,7 +250,8 @@ static int mmap_frag(abi_ulong real_start, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mprotect(host_start, qem= u_host_page_size, prot1 | PROT_WRITE); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* read the corresponding file data */ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0pread(fd, g2h(start), end - start, offset); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pread(fd, g2h(start), end - start, offs= et) =3D=3D -1) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -errno; > > This needs to be checked but iirc, it's wrong. One should set errno and > return -1. Please double check and fix if needed. Thanks.