Run through Clang's android-cloexec checkers

This is mainly useful with SELinux.
This commit is contained in:
Rosen Penev
2019-08-03 22:37:37 -07:00
parent 98e17d5774
commit 2f76326c37
2 changed files with 11 additions and 3 deletions
+5 -1
View File
@@ -336,7 +336,11 @@ bool hc_path_create (const char *path)
{
if (hc_path_exist (path) == true) return false;
const int fd = creat (path, S_IRUSR | S_IWUSR);
#ifdef O_CLOEXEC
const int fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR);
#else
const int fd = open (path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
#endif
if (fd == -1) return false;