From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XX1rI-0007J1-68 for barebox@lists.infradead.org; Thu, 25 Sep 2014 05:44:53 +0000 Date: Thu, 25 Sep 2014 07:44:28 +0200 From: Sascha Hauer Message-ID: <20140925054428.GD4992@pengutronix.de> References: <1411541391-19948-1-git-send-email-t.gamez@phytec.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1411541391-19948-1-git-send-email-t.gamez@phytec.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH] read_file_2: Fix return value To: Teresa =?iso-8859-15?Q?G=E1mez?= Cc: barebox@lists.infradead.org On Wed, Sep 24, 2014 at 08:49:51AM +0200, Teresa G=E1mez wrote: > Set return value correct in error case. > This prevents barebox from crashing in some conditions. > = > Signed-off-by: Teresa G=E1mez Applied, thanks Sascha > --- > lib/libfile.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > = > diff --git a/lib/libfile.c b/lib/libfile.c > index c6fb6d7..c626e2f 100644 > --- a/lib/libfile.c > +++ b/lib/libfile.c > @@ -163,8 +163,10 @@ again: > buf =3D xzalloc(read_size + 1); > = > fd =3D open(filename, O_RDONLY); > - if (fd < 0) > + if (fd < 0) { > + ret =3D fd; > goto err_out; > + } > = > ret =3D read_full(fd, buf, read_size); > if (ret < 0) > -- = > 1.7.0.4 > = > = > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox -- = Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox