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/08/11 17:11:41 UTC

[nuttx-apps] branch master updated: nxrecorder: mode is required when oflags include O_CREAT or O_WRONLY

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-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a4e9e438 nxrecorder: mode is required when oflags include O_CREAT or O_WRONLY
5a4e9e438 is described below

commit 5a4e9e4389264522d02dae78bcb3f9813743300f
Author: huxiandong <hu...@xiaomi.com>
AuthorDate: Fri Feb 17 13:28:08 2023 +0800

    nxrecorder: mode is required when oflags include O_CREAT or O_WRONLY
    
    Refer -- fs_open.c:
    /* If the file is opened for creation, then get the mode bits */
    
      if ((oflags & (O_WRONLY | O_CREAT)) != 0)
        {
          mode = va_arg(ap, mode_t);
        }
    
    Signed-off-by: huxiandong <hu...@xiaomi.com>
---
 system/nxrecorder/nxrecorder.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c
index 7f5bdbd06..de6051857 100644
--- a/system/nxrecorder/nxrecorder.c
+++ b/system/nxrecorder/nxrecorder.c
@@ -1034,7 +1034,8 @@ int nxrecorder_recordinternal(FAR struct nxrecorder_s *precorder,
 
   /* Test that the specified file exists */
 
-  if ((precorder->fd = open(pfilename, O_WRONLY | O_CREAT | O_TRUNC)) == -1)
+  if ((precorder->fd = open(pfilename, O_WRONLY | O_CREAT | O_TRUNC,
+                            0666)) == -1)
     {
       /* File not found.  Test if its in the mediadir */