summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 440adae14c..966abe9408 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -935,8 +935,10 @@ int erase(int fd, loff_t count, loff_t offset)
f = &files[fd];
if (offset >= f->size)
return 0;
- if (count > f->size - offset)
+ if (count == ERASE_SIZE_ALL || count > f->size - offset)
count = f->size - offset;
+ if (count < 0)
+ return -EINVAL;
fsdrv = f->fsdev->driver;
if (fsdrv->erase)