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

commit e55666f90e97fd6d83401295372a53344228dd2e
Author: wanggang26 <[email protected]>
AuthorDate: Fri Nov 24 10:34:00 2023 +0800

    fastboot:enable O_CLOEXEC explicit
    
    Signed-off-by: wanggang26 <[email protected]>
---
 system/fastboot/fastboot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c
index f35d41741..c9b348f5b 100644
--- a/system/fastboot/fastboot.c
+++ b/system/fastboot/fastboot.c
@@ -230,7 +230,7 @@ static void fastboot_okay(FAR struct fastboot_ctx_s 
*context,
 
 static int fastboot_flash_open(FAR const char *name)
 {
-  int fd = open(name, O_RDWR);
+  int fd = open(name, O_RDWR | O_CLOEXEC);
   if (fd < 0)
     {
       fb_err("Open %s error\n", name);
@@ -741,7 +741,7 @@ int main(int argc, FAR char **argv)
 
   snprintf(usbdev, sizeof(usbdev), "%s/ep%d",
            FASTBOOT_USBDEV, FASTBOOT_EP_BULKOUT_IDX + 1);
-  context.usbdev_in = open(usbdev, O_RDONLY);
+  context.usbdev_in = open(usbdev, O_RDONLY | O_CLOEXEC);
   if (context.usbdev_in < 0)
     {
       fb_err("open [%s] error\n", usbdev);
@@ -751,7 +751,7 @@ int main(int argc, FAR char **argv)
 
   snprintf(usbdev, sizeof(usbdev), "%s/ep%d",
            FASTBOOT_USBDEV, FASTBOOT_EP_BULKIN_IDX + 1);
-  context.usbdev_out = open(usbdev, O_WRONLY);
+  context.usbdev_out = open(usbdev, O_WRONLY | O_CLOEXEC);
   if (context.usbdev_out < 0)
     {
       fb_err("open [%s] error\n", usbdev);

Reply via email to