Fsutil: allow truncate to arbitrary length.

This commit is contained in:
Serge Vakulenko
2014-07-17 21:31:49 -07:00
parent 08c79d7fec
commit 847e2bff77
5 changed files with 64 additions and 30 deletions

View File

@@ -173,6 +173,12 @@ int op_open(const char *path, struct fuse_file_info *fi)
return -ENOENT;
}
if ((file.inode.mode & INODE_MODE_FMT) != INODE_MODE_FREG) {
/* Cannot open special files. */
file.inode.mode = 0;
return -ENXIO;
}
if (fi->flags & O_APPEND) {
file.offset = file.inode.size;
}