From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NN9aA-00016K-7u for qemu-devel@nongnu.org; Tue, 22 Dec 2009 13:35:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NN9a5-00013e-Jf for qemu-devel@nongnu.org; Tue, 22 Dec 2009 13:35:41 -0500 Received: from [199.232.76.173] (port=48794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NN9a5-00013V-Cs for qemu-devel@nongnu.org; Tue, 22 Dec 2009 13:35:37 -0500 Received: from mail-yw0-f171.google.com ([209.85.211.171]:55365) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NN9a4-00070i-A8 for qemu-devel@nongnu.org; Tue, 22 Dec 2009 13:35:37 -0500 Received: by ywh1 with SMTP id 1so6041924ywh.18 for ; Tue, 22 Dec 2009 10:35:32 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1261273167-3240-2-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> From: Blue Swirl Date: Tue, 22 Dec 2009 18:35:12 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 02/18] block.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.o > cc1: warnings being treated as errors > block.c: In function 'bdrv_open2': > block.c:400: error: ignoring return value of 'realpath', declared with at= tribute warn_unused_result > > Signed-off-by: Kirill A. Shutemov > --- > =C2=A0block.c | =C2=A0 =C2=A04 ++-- > =C2=A01 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/block.c b/block.c > index 3f3496e..30ae2b1 100644 > --- a/block.c > +++ b/block.c > @@ -396,8 +396,8 @@ int bdrv_open2(BlockDriverState *bs, const char *file= name, int flags, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (is_protocol) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 snprintf(backing_filename, size= of(backing_filename), > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"%s", filename); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0else > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0realpath(filename, backing_fil= ename); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0else if (!realpath(filename, backing_filenam= e)) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -errno; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 bdrv_qcow2 =3D bdrv_find_format("qcow2"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 options =3D parse_option_parameters("", bdrv_= qcow2->create_options, NULL); This patch appears to be correct considering: - return value of realpath - errno codes in the error case (as advertised by Linux man page and the functions referenced by OpenBSD man page: lstat(), readlink(2) and getcwd()) - return value of bdrv_open2().