[PATCH 4/6] fs: Remove O_TRUNC check for devices when open files

Teresa Remmet t.remmet at phytec.de
Fri Nov 25 00:06:05 PST 2016


Don't check for the file type here. Devices may have truncate
callbacks. Otherwise the caller should check if O_TRUNC is possible.

Signed-off-by: Teresa Remmet <t.remmet at phytec.de>
---
 fs/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index b7e7c63..2b4659c 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -682,7 +682,7 @@ int open(const char *pathname, int flags, ...)
 	if (ret)
 		goto out;
 
-	if (!(s.st_mode & S_IFCHR) && (flags & O_TRUNC)) {
+	if (flags & O_TRUNC) {
 		ret = fsdrv->truncate(&fsdev->dev, f, 0);
 		f->size = 0;
 		if (ret)
-- 
1.9.1




More information about the barebox mailing list