Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,11 @@ int dfs_elm_flush(struct dfs_file *file)
FIL *fd;
FRESULT result;

if (file->vnode->type == FT_DIRECTORY)
{
return -EISDIR;
}

fd = (FIL *)(file->data);
RT_ASSERT(fd != RT_NULL);

Expand Down
5 changes: 5 additions & 0 deletions components/dfs/dfs_v1/src/dfs_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ int fsync(int fildes)
}

ret = dfs_file_flush(d);
if (ret < 0)
{
rt_set_errno(ret);
return -1;
}

return ret;
}
Expand Down
5 changes: 5 additions & 0 deletions components/dfs/dfs_v2/filesystems/elmfat/dfs_elm.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,11 @@ int dfs_elm_flush(struct dfs_file *file)
FIL *fd;
FRESULT result;

if (file->vnode->type == FT_DIRECTORY)
{
return -EISDIR;
}

fd = (FIL *)(file->vnode->data);
RT_ASSERT(fd != RT_NULL);

Expand Down
6 changes: 6 additions & 0 deletions components/dfs/dfs_v2/src/dfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,7 @@ int dfs_file_rename(const char *old_file, const char *new_file)
* @return int Operation result:
* - 0 on success
* -EBADF if invalid file descriptor
* -EISDIR if the file is a directory (directories cannot be truncated)
* -ENOSYS if truncate operation not supported
* -EINVAL if invalid parameters or not mounted
*
Expand All @@ -2214,6 +2215,11 @@ int dfs_file_ftruncate(struct dfs_file *file, off_t length)

if (file)
{
if (file->vnode->type == FT_DIRECTORY)
{
return -EISDIR;
}

if (file->fops->truncate)
{
if (dfs_is_mounted(file->vnode->mnt) == 0)
Expand Down
5 changes: 5 additions & 0 deletions components/dfs/dfs_v2/src/dfs_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ int fsync(int fildes)
}

ret = dfs_file_fsync(file);
if (ret < 0)
{
rt_set_errno(ret);
return -1;
}

return ret;
}
Expand Down
Loading