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 canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RG6fb-0005u9-7t for barebox@lists.infradead.org; Tue, 18 Oct 2011 10:13:16 +0000 Date: Tue, 18 Oct 2011 12:13:10 +0200 From: Sascha Hauer Message-ID: <20111018101310.GK18141@pengutronix.de> References: <1318931325-31138-1-git-send-email-antonynpavlov@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1318931325-31138-1-git-send-email-antonynpavlov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [RFC PATCH 1/2] fs: fix path_check_prereq() To: Antony Pavlov Cc: barebox@lists.infradead.org On Tue, Oct 18, 2011 at 01:48:44PM +0400, Antony Pavlov wrote: > This patch makes impossible the situations than path_check_prereq() can make > 'return 0' without changing errno. Both applied to master. Thanks for fixing this. Sascha > > Signed-off-by: Antony Pavlov > --- > fs/fs.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/fs.c b/fs/fs.c > index 7d65ec8..714fc9b 100644 > --- a/fs/fs.c > +++ b/fs/fs.c > @@ -293,9 +293,11 @@ static int path_check_prereq(const char *path, unsigned int flags) > struct stat s; > unsigned int m; > > + errno = 0; > + > if (stat(path, &s)) { > if (flags & S_UB_DOES_NOT_EXIST) > - return 0; > + goto out; > errno = -ENOENT; > goto out; > } > @@ -306,7 +308,7 @@ static int path_check_prereq(const char *path, unsigned int flags) > } > > if (flags == S_UB_EXISTS) > - return 0; > + goto out; > > m = s.st_mode; > > @@ -325,7 +327,6 @@ static int path_check_prereq(const char *path, unsigned int flags) > goto out; > } > > - errno = 0; > out: > return errno; > } > -- > 1.7.6.3 > > > _______________________________________________ > 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