From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNBsF-0007kh-NH for qemu-devel@nongnu.org; Tue, 22 Dec 2009 16:02:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNBsA-0007jD-KS for qemu-devel@nongnu.org; Tue, 22 Dec 2009 16:02:30 -0500 Received: from [199.232.76.173] (port=34876 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNBsA-0007jA-9J for qemu-devel@nongnu.org; Tue, 22 Dec 2009 16:02:26 -0500 Received: from mail-yw0-f171.google.com ([209.85.211.171]:39456) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNBs9-00058R-Rl for qemu-devel@nongnu.org; Tue, 22 Dec 2009 16:02:25 -0500 Received: by ywh1 with SMTP id 1so6169843ywh.18 for ; Tue, 22 Dec 2009 13:02:25 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1261273167-3240-7-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> From: Blue Swirl Date: Tue, 22 Dec 2009 21:02:05 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 07/18] block/bochs.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=A0block/bochs.o > cc1: warnings being treated as errors > block/bochs.c: In function 'seek_to_sector': > block/bochs.c:202: error: ignoring return value of 'read', declared with = attribute warn_unused_result > make: *** [block/bochs.o] Error 1 > > Signed-off-by: Kirill A. Shutemov > --- > =C2=A0block/bochs.c | =C2=A0 =C2=A03 ++- > =C2=A01 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/block/bochs.c b/block/bochs.c > index bac81c4..f6a18f2 100644 > --- a/block/bochs.c > +++ b/block/bochs.c > @@ -199,7 +199,8 @@ static inline int seek_to_sector(BlockDriverState *bs= , int64_t sector_num) > =C2=A0 =C2=A0 // read in bitmap for current extent > =C2=A0 =C2=A0 lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET)= ; > > - =C2=A0 =C2=A0read(s->fd, &bitmap_entry, 1); > + =C2=A0 =C2=A0if (read(s->fd, &bitmap_entry, 1) !=3D 1) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1; I think a short read can't happen with 1 bytes, so this looks fine. Though error checking is incomplete unless it is extended to lseek() calls = too.