mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/7] fs: errno should be set correctly before the end of functions
Date: Mon,  4 Apr 2011 15:09:43 +0200	[thread overview]
Message-ID: <1301922585-8144-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1301922585-8144-1-git-send-email-s.hauer@pengutronix.de>

Otherwise we end up with errno not being set correctly
if a filesystem driver uses the standard open/close/read/write
functions to access its backing store.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 2f61929..f684d45 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -292,8 +292,6 @@ 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;
@@ -325,6 +323,8 @@ static int path_check_prereq(const char *path, unsigned int flags)
 		errno = -ENOTDIR;
 		goto out;
 	}
+
+	errno = 0;
 out:
 	return errno;
 }
@@ -800,6 +800,7 @@ int mount(const char *device, const char *fsname, const char *_path)
 			e = e->next;
 		e->next = entry;
 	}
+	errno = 0;
 out:
 	free(path);
 	return errno;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-04-04 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 13:09 various fixes and updates Sascha Hauer
2011-04-04 13:09 ` [PATCH 1/7] arm: update mach-types Sascha Hauer
2011-04-04 13:09 ` [PATCH 2/7] driver: Do not forget to remove device from active list Sascha Hauer
2011-04-04 13:09 ` [PATCH 3/7] memcpy command: do not set read/write size Sascha Hauer
2011-04-04 13:09 ` [PATCH 4/7] mmc: check correctness of the voltage mask in ocr Sascha Hauer
2011-04-04 13:09 ` Sascha Hauer [this message]
2011-04-04 13:09 ` [PATCH 6/7] usbnet: do not initialize ethernet device from usb device Sascha Hauer
2011-04-04 13:09 ` [PATCH 7/7] ARM: Add missing parameter name 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=1301922585-8144-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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