summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/fs.c b/fs/fs.c
index ce7b425546..7d558e90d0 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -722,8 +722,7 @@ int open(const char *pathname, int flags, ...)
if (ret)
goto out;
-
- if (flags & O_TRUNC) {
+ if (!(s.st_mode & S_IFCHR) && (flags & O_TRUNC)) {
ret = fsdrv->truncate(&fsdev->dev, f, 0);
f->size = 0;
if (ret)