You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/06/17 11:31:25 UTC

[nuttx] 02/02: fs_fsync: should not call fs's ioctl when fs not support sync api

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

commit 7117d3ea8ac5358e0652708b22a933f91bcf3f10
Author: wangbowen6 <wa...@xiaomi.com>
AuthorDate: Tue Apr 18 14:11:08 2023 +0800

    fs_fsync: should not call fs's ioctl when fs not support sync api
    
    Signed-off-by: wangbowen6 <wa...@xiaomi.com>
---
 fs/vfs/fs_fsync.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/vfs/fs_fsync.c b/fs/vfs/fs_fsync.c
index 21c361851d..6093c6710f 100644
--- a/fs/vfs/fs_fsync.c
+++ b/fs/vfs/fs_fsync.c
@@ -64,12 +64,14 @@ int file_fsync(FAR struct file *filep)
   if (inode != NULL)
     {
 #ifndef CONFIG_DISABLE_MOUNTPOINT
-      if (INODE_IS_MOUNTPT(inode) && inode->u.i_mops &&
-          inode->u.i_mops->sync)
+      if (INODE_IS_MOUNTPT(inode))
         {
-          /* Yes, then tell the mountpoint to sync this file */
+          if (inode->u.i_mops && inode->u.i_mops->sync)
+            {
+              /* Yes, then tell the mountpoint to sync this file */
 
-          return inode->u.i_mops->sync(filep);
+              return inode->u.i_mops->sync(filep);
+            }
         }
       else
 #endif