19 lines · plain
1.. title:: clang-tidy - android-cloexec-dup2 3android-cloexec-dup4===================5 6The usage of ``dup()`` is not recommended, it's better to use ``fcntl()``,7which can set the close-on-exec flag. Otherwise, an opened sensitive file would8remain open across a fork+exec to a lower-privileged SELinux domain.9 10Examples:11 12.. code-block:: c++13 14 int fd = dup(oldfd);15 16 // becomes17 18 int fd = fcntl(oldfd, F_DUPFD_CLOEXEC);19