mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-15 12:29:35 +00:00
Run through Clang's android-cloexec checkers
This is mainly useful with SELinux.
This commit is contained in:
parent
98e17d5774
commit
2f76326c37
@ -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…
Reference in New Issue
Block a user