From e55666f90e97fd6d83401295372a53344228dd2e Mon Sep 17 00:00:00 2001 From: wanggang26 Date: Fri, 24 Nov 2023 10:34:00 +0800 Subject: [PATCH] fastboot:enable O_CLOEXEC explicit Signed-off-by: wanggang26 --- 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);