1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

fallback to ~/.hashcat if the xdg base directory does not exist

This commit is contained in:
nycex 2020-07-05 14:47:51 +02:00
parent d018469aef
commit 964eb51dd9
No known key found for this signature in database
GPG Key ID: EE6FBE8D3E7278A5

View File

@ -97,14 +97,22 @@ static void get_profile_dir (char *profile_dir, const char *home_dir)
if (stat (profile_dir, &st) == 0 && S_ISDIR (st.st_mode))
return;
char *data_dir = (char *) hcmalloc (HCBUFSIZ_TINY);
if (getenv("XDG_DATA_HOME"))
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", getenv("XDG_DATA_HOME"));
strncpy (data_dir, getenv("XDG_DATA_HOME"), HCBUFSIZ_TINY);
}
else
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/.local/share/hashcat", home_dir);
snprintf (data_dir, HCBUFSIZ_TINY, "%s/.local/share", home_dir);
}
if (access (data_dir, R_OK) != -1)
{
snprintf (profile_dir, HCBUFSIZ_TINY, "%s/hashcat", data_dir);
}
hcfree (data_dir);
}
static void get_session_dir (char *session_dir, const char *profile_dir)