[PATCH 2/5] fs: set errno in ftruncate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ftruncate needs to set errno correctly on error.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux