mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [RFC PATCH 1/2] fs: fix path_check_prereq()
Date: Tue, 18 Oct 2011 12:13:10 +0200	[thread overview]
Message-ID: <20111018101310.GK18141@pengutronix.de> (raw)
In-Reply-To: <1318931325-31138-1-git-send-email-antonynpavlov@gmail.com>

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 <antonynpavlov@gmail.com>
> ---
>  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

  parent reply	other threads:[~2011-10-18 10:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  9:48 Antony Pavlov
2011-10-18  9:48 ` [RFC PATCH 2/2] fs: fix chdir() Antony Pavlov
2011-10-18 10:13 ` Sascha Hauer [this message]
2011-10-19  9:51 ` [RFC PATCH 1/2] fs: fix path_check_prereq() Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111018101310.GK18141@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox