1
mirror of https://github.com/hashcat/hashcat synced 2024-12-23 14:13:43 +01:00

Added hc_mkdir instead of mkdir macro

This commit is contained in:
jsteube 2016-10-01 13:51:06 +02:00
parent b17d00d873
commit 5f18fb40f1
4 changed files with 18 additions and 9 deletions

View File

@ -21,15 +21,12 @@
#if defined (_WIN)
#include <windows.h>
#include <direct.h>
#endif
#define DOT_HASHCAT ".hashcat"
#define SESSIONS_FOLDER "sessions"
#if defined (_WIN)
#define mkdir(name,mode) mkdir (name)
#endif
int sort_by_stringptr (const void *p1, const void *p2);
char *get_exec_path (void);
@ -43,3 +40,5 @@ char **scan_directory (const char *path);
int folder_config_init (folder_config_t *folder_config, const char *install_folder, const char *shared_folder);
void folder_config_destroy (folder_config_t *folder_config);
int hc_mkdir (const char *name, int mode);

View File

@ -294,8 +294,8 @@ int folder_config_init (folder_config_t *folder_config, const char *install_fold
session_dir = get_session_dir (profile_dir);
shared_dir = mystrdup (shared_folder);
mkdir (profile_dir, 0700);
mkdir (session_dir, 0700);
hc_mkdir (profile_dir, 0700);
hc_mkdir (session_dir, 0700);
}
else
{
@ -391,7 +391,7 @@ int folder_config_init (folder_config_t *folder_config, const char *install_fold
snprintf (kernels_folder, HCBUFSIZ_TINY - 1, "%s/kernels", profile_dir);
mkdir (kernels_folder, 0700);
hc_mkdir (kernels_folder, 0700);
myfree (kernels_folder);
@ -424,3 +424,13 @@ void folder_config_destroy (folder_config_t *folder_config)
myfree (folder_config);
}
int hc_mkdir (const char *name, int mode)
{
#if defined (_WIN)
if (mode == 0) mode = 0; // makes compiler happy
return _mkdir (name);
#else
return mkdir (name, mode);
#endif
}

View File

@ -72,7 +72,7 @@ int induct_ctx_init (induct_ctx_t *induct_ctx, const user_options_t *user_option
}
}
if (mkdir (root_directory, 0700) == -1)
if (hc_mkdir (root_directory, 0700) == -1)
{
log_error ("ERROR: %s: %s", root_directory, strerror (errno));

View File

@ -361,7 +361,7 @@ int outcheck_ctx_init (outcheck_ctx_t *outcheck_ctx, const user_options_t *user_
}
else
{
if (mkdir (outcheck_ctx->root_directory, 0700) == -1)
if (hc_mkdir (outcheck_ctx->root_directory, 0700) == -1)
{
log_error ("ERROR: %s: %s", outcheck_ctx->root_directory, strerror (errno));