Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/android/cloexec-dup.rst

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