From patchwork Sun Dec 20 01:39:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 41504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24E8DB6F1A for ; Sun, 20 Dec 2009 13:08:38 +1100 (EST) Received: from localhost ([127.0.0.1]:45106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMBDm-0004iA-Un for incoming@patchwork.ozlabs.org; Sat, 19 Dec 2009 21:08:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMAmF-0008B2-EC for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMAmA-00086f-TB for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:06 -0500 Received: from [199.232.76.173] (port=54486 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMAmA-00086R-38 for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:02 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:56134) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMAm9-0004ms-Kg for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:01 -0500 Received: by mail-fx0-f222.google.com with SMTP id 22so4042062fxm.2 for ; Sat, 19 Dec 2009 17:40:01 -0800 (PST) Received: by 10.223.16.216 with SMTP id p24mr2571619faa.35.1261273201198; Sat, 19 Dec 2009 17:40:01 -0800 (PST) Received: from localhost.localdomain (a88-114-220-92.elisa-laajakaista.fi [88.114.220.92]) by mx.google.com with ESMTPS id 13sm6982256fks.45.2009.12.19.17.39.59 (version=SSLv3 cipher=RC4-MD5); Sat, 19 Dec 2009 17:40:00 -0800 (PST) From: "Kirill A. Shutemov" To: qemu-devel@nongnu.org Date: Sun, 20 Dec 2009 03:39:27 +0200 Message-Id: <1261273167-3240-18-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.6.5.6 In-Reply-To: <1261273167-3240-17-git-send-email-kirill@shutemov.name> References: <1261273167-3240-1-git-send-email-kirill@shutemov.name> <1261273167-3240-2-git-send-email-kirill@shutemov.name> <1261273167-3240-3-git-send-email-kirill@shutemov.name> <1261273167-3240-4-git-send-email-kirill@shutemov.name> <1261273167-3240-5-git-send-email-kirill@shutemov.name> <1261273167-3240-6-git-send-email-kirill@shutemov.name> <1261273167-3240-7-git-send-email-kirill@shutemov.name> <1261273167-3240-8-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> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: "Kirill A. Shutemov" Subject: [Qemu-devel] [PATCH 18/18] linux-user/mmap.c: fix warnings with _FORTIFY_SOURCE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CC i386-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_frag': /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:253: error: ignoring return value of 'pread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'target_mmap': /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:477: error: ignoring return value of 'pread', declared with attribute warn_unused_result make[1]: *** [mmap.o] Error 1 Signed-off-by: Kirill A. Shutemov --- linux-user/mmap.c | 6 ++++-- 1 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, mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); /* read the corresponding file data */ - pread(fd, g2h(start), end - start, offset); + if (pread(fd, g2h(start), end - start, offset) == -1) + return -errno; /* put final protection */ if (prot_new != (prot1 | PROT_WRITE)) @@ -474,7 +475,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, -1, 0); if (retaddr == -1) goto fail; - pread(fd, g2h(start), len, offset); + if (pread(fd, g2h(start), len, offset) == -1) + return -errno; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); if (ret != 0) {