This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 35602cc2ef fs_fsync.c:Fix unknown command message in non-block device 
situations
35602cc2ef is described below

commit 35602cc2effe923e8c9b635bfc5f11cea36f7ccb
Author: chenrun1 <[email protected]>
AuthorDate: Wed Aug 2 21:55:39 2023 +0800

    fs_fsync.c:Fix unknown command message in non-block device situations
    
    This command is called only if the device is a block device or mtd
    device.
    
    Signed-off-by: chenrun1 <[email protected]>
---
 fs/vfs/fs_fsync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/vfs/fs_fsync.c b/fs/vfs/fs_fsync.c
index 6093c6710f..dc48e4c37e 100644
--- a/fs/vfs/fs_fsync.c
+++ b/fs/vfs/fs_fsync.c
@@ -75,7 +75,8 @@ int file_fsync(FAR struct file *filep)
         }
       else
 #endif
-      if (inode->u.i_ops && inode->u.i_ops->ioctl)
+      if ((INODE_IS_BLOCK(inode) || INODE_IS_MTD(inode)) &&
+          inode->u.i_ops && inode->u.i_ops->ioctl)
         {
           ret = inode->u.i_ops->ioctl(filep, BIOC_FLUSH, 0);
           return ret >= 0 ? 0 : ret;

Reply via email to