* [PATCH 1/2] fs: open: Do not forget to set errno
@ 2018-09-26 8:25 Sascha Hauer
2018-09-26 8:25 ` [PATCH 2/2] fs: stat: " Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2018-09-26 8:25 UTC (permalink / raw)
To: Barebox List; +Cc: Ladislav Michl
When the initial lookup fails in open we have to go to the error path
which sets errno correctly rather than returning directly.
Fixes: b3fbfad7ae ("fs: dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fs.c b/fs/fs.c
index 41818ea811..d4ac37943e 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2237,7 +2237,7 @@ int open(const char *pathname, int flags, ...)
putname(nd.name);
if (error)
- return error;
+ goto out1;
if (d_is_negative(dentry)) {
if (flags & O_CREAT) {
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] fs: stat: Do not forget to set errno
2018-09-26 8:25 [PATCH 1/2] fs: open: Do not forget to set errno Sascha Hauer
@ 2018-09-26 8:25 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2018-09-26 8:25 UTC (permalink / raw)
To: Barebox List; +Cc: Ladislav Michl
stat() needs to set errno correctly when returning with an error.
Fixes: b3fbfad7ae ("fs: dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/fs.c b/fs/fs.c
index d4ac37943e..2a4d78c9d7 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2535,6 +2535,9 @@ static int stat_filename(const char *filename, struct stat *s, unsigned int flag
out_put:
path_put(&path);
out:
+ if (ret)
+ errno = -ret;
+
return ret;
}
--
2.19.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-26 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 8:25 [PATCH 1/2] fs: open: Do not forget to set errno Sascha Hauer
2018-09-26 8:25 ` [PATCH 2/2] fs: stat: " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox