You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/01/14 08:01:52 UTC

[incubator-nuttx] branch master updated: Do not require write-access for fsync

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 39ab0f4  Do not require write-access for fsync
39ab0f4 is described below

commit 39ab0f48364e55adab4336385dce4e2d7ade4095
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Jan 14 14:15:09 2022 +0900

    Do not require write-access for fsync
    
    * fsync doesn't modify the file. It doesn't make sense to require
      write-access.
    
    * This matches what ~all other systems do.
      At least Linux, macOS, and NetBSD.
---
 fs/vfs/fs_fsync.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/fs/vfs/fs_fsync.c b/fs/vfs/fs_fsync.c
index e49f6f6..2eb4cc0 100644
--- a/fs/vfs/fs_fsync.c
+++ b/fs/vfs/fs_fsync.c
@@ -55,13 +55,6 @@ int file_fsync(FAR struct file *filep)
 {
   struct inode *inode;
 
-  /* Was this file opened for write access? */
-
-  if ((filep->f_oflags & O_WROK) == 0)
-    {
-      return -EBADF;
-    }
-
   /* Is this inode a registered mountpoint? Does it support the
    * sync operations may be relevant to device drivers but only
    * the mountpoint operations vtable contains a sync method.