From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 2/5] fs: set errno in ftruncate()
Date: Mon, 4 Feb 2019 15:46:38 +0100 [thread overview]
Message-ID: <20190204144641.19600-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190204144641.19600-1-s.hauer@pengutronix.de>
ftruncate needs to set errno correctly on error.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/fs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/fs.c b/fs/fs.c
index 4ec9c7a842..c5b17e158a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -216,8 +216,10 @@ int ftruncate(int fd, loff_t length)
fsdrv = f->fsdev->driver;
ret = fsdrv->truncate(&f->fsdev->dev, f, length);
- if (ret)
+ if (ret) {
+ errno = -ret;
return ret;
+ }
f->size = length;
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-02-04 14:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer
2019-02-04 14:46 ` [PATCH 1/5] fs: let truncate take a loff_t argument Sascha Hauer
2019-02-04 14:46 ` Sascha Hauer [this message]
2019-02-04 14:46 ` [PATCH 3/5] fs: do not call truncate for FILE_SIZE_STREAM sized files Sascha Hauer
2019-02-04 14:46 ` [PATCH 4/5] fs: devfs: forbid truncation when cdev has no truncate operation Sascha Hauer
2019-02-04 14:46 ` [PATCH 5/5] misc: fix /dev/mem size Sascha Hauer
2019-02-05 21:44 ` [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov
2019-02-06 7:33 ` Sascha Hauer
2019-02-06 7:37 ` Andrey Smirnov
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=20190204144641.19600-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=andrew.smirnov@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