Run through Clang's android-cloexec checkers

This is mainly useful with SELinux.
pull/2144/head
Rosen Penev 5 years ago
parent 98e17d5774
commit 2f76326c37
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B

@ -371,8 +371,8 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont
#ifndef DEBUG
#ifndef _WIN
fflush (stderr);
int bak = dup (2);
int tmp = open ("/dev/null", O_WRONLY);
int bak = fcntl(2, F_DUPFD_CLOEXEC);
int tmp = open ("/dev/null", O_WRONLY | O_CLOEXEC);
dup2 (tmp, 2);
close (tmp);
#endif
@ -383,7 +383,11 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont
#ifndef DEBUG
#ifndef _WIN
fflush (stderr);
#ifndef __APPLE__
dup3 (bak, 2, O_CLOEXEC);
#else
dup2 (bak, 2);
#endif
close (bak);
#endif
#endif

@ -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;

Loading…
Cancel
Save