From 35602cc2effe923e8c9b635bfc5f11cea36f7ccb Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Wed, 2 Aug 2023 21:55:39 +0800 Subject: [PATCH] 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 --- 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;