mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Use hc_stat from types.c instead of OS dependant branching
This commit is contained in:
parent
3203ad4e89
commit
2994afd81a
@ -67,6 +67,20 @@ typedef pthread_t hc_thread_t;
|
||||
typedef pthread_mutex_t hc_thread_mutex_t;
|
||||
#endif
|
||||
|
||||
// stat
|
||||
|
||||
#if defined (_POSIX)
|
||||
typedef struct stat hc_stat;
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
#if defined (_MSC_VER)
|
||||
typedef struct _stat64 hc_stat;
|
||||
#else
|
||||
typedef struct stat64 hc_stat;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// enums
|
||||
|
||||
typedef enum amplifier_count
|
||||
|
@ -74,15 +74,13 @@ void dictstat_read (dictstat_ctx_t *dictstat_ctx, const int comptime)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined (_POSIX)
|
||||
struct stat tmpstat;
|
||||
hc_stat tmpstat;
|
||||
|
||||
#if defined (_POSIX)
|
||||
fstat (fileno (fp), &tmpstat);
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
struct stat64 tmpstat;
|
||||
|
||||
_fstat64 (fileno (fp), &tmpstat);
|
||||
#endif
|
||||
|
||||
|
@ -167,15 +167,8 @@ int outfile_and_hashfile (outfile_ctx_t *outfile_ctx, const char *hashfile)
|
||||
|
||||
if (outfile == NULL) return 0;
|
||||
|
||||
#if defined (_POSIX)
|
||||
struct stat tmpstat_outfile;
|
||||
struct stat tmpstat_hashfile;
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
struct stat64 tmpstat_outfile;
|
||||
struct stat64 tmpstat_hashfile;
|
||||
#endif
|
||||
hc_stat tmpstat_outfile;
|
||||
hc_stat tmpstat_hashfile;
|
||||
|
||||
FILE *tmp_outfile_fp = fopen (outfile, "r");
|
||||
|
||||
@ -231,23 +224,12 @@ int outfile_and_hashfile (outfile_ctx_t *outfile_ctx, const char *hashfile)
|
||||
tmpstat_hashfile.st_blocks = 0;
|
||||
#endif
|
||||
|
||||
#if defined (_POSIX)
|
||||
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat)) == 0)
|
||||
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (hc_stat)) == 0)
|
||||
{
|
||||
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat64)) == 0)
|
||||
{
|
||||
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -128,15 +128,13 @@ static void outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
//hc_thread_mutex_lock (status_ctx->mux_display);
|
||||
|
||||
#if defined (_POSIX)
|
||||
struct stat outfile_stat;
|
||||
hc_stat outfile_stat;
|
||||
|
||||
#if defined (_POSIX)
|
||||
fstat (fileno (fp), &outfile_stat);
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
struct stat64 outfile_stat;
|
||||
|
||||
_fstat64 (fileno (fp), &outfile_stat);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user