mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 07:08:19 +00:00
Merge pull request #3622 from justpretending/fifo_again
Don't close and reopen a FIFO
This commit is contained in:
commit
1ac3091492
@ -2101,6 +2101,7 @@ typedef struct outfile_ctx
|
|||||||
|
|
||||||
u32 outfile_format;
|
u32 outfile_format;
|
||||||
bool outfile_autohex;
|
bool outfile_autohex;
|
||||||
|
bool is_fifo;
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
@ -503,6 +503,7 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
outfile_ctx->filename = user_options->outfile;
|
outfile_ctx->filename = user_options->outfile;
|
||||||
outfile_ctx->outfile_format = user_options->outfile_format;
|
outfile_ctx->outfile_format = user_options->outfile_format;
|
||||||
outfile_ctx->outfile_autohex = user_options->outfile_autohex;
|
outfile_ctx->outfile_autohex = user_options->outfile_autohex;
|
||||||
|
outfile_ctx->is_fifo = hc_path_is_fifo (outfile_ctx->filename);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -511,6 +512,13 @@ void outfile_destroy (hashcat_ctx_t *hashcat_ctx)
|
|||||||
{
|
{
|
||||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||||
|
|
||||||
|
if (outfile_ctx->is_fifo == true && outfile_ctx->fp.pfp != NULL)
|
||||||
|
{
|
||||||
|
hc_unlockfile (&outfile_ctx->fp);
|
||||||
|
|
||||||
|
hc_fclose (&outfile_ctx->fp);
|
||||||
|
}
|
||||||
|
|
||||||
memset (outfile_ctx, 0, sizeof (outfile_ctx_t));
|
memset (outfile_ctx, 0, sizeof (outfile_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,6 +528,8 @@ int outfile_write_open (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (outfile_ctx->filename == NULL) return 0;
|
if (outfile_ctx->filename == NULL) return 0;
|
||||||
|
|
||||||
|
if (outfile_ctx->is_fifo == false || outfile_ctx->fp.pfp == NULL)
|
||||||
|
{
|
||||||
if (hc_fopen (&outfile_ctx->fp, outfile_ctx->filename, "ab") == false)
|
if (hc_fopen (&outfile_ctx->fp, outfile_ctx->filename, "ab") == false)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
||||||
@ -535,6 +545,7 @@ int outfile_write_open (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -545,6 +556,12 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (outfile_ctx->fp.pfp == NULL) return;
|
if (outfile_ctx->fp.pfp == NULL) return;
|
||||||
|
|
||||||
|
if (outfile_ctx->is_fifo == true)
|
||||||
|
{
|
||||||
|
hc_fflush (&outfile_ctx->fp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hc_unlockfile (&outfile_ctx->fp);
|
hc_unlockfile (&outfile_ctx->fp);
|
||||||
|
|
||||||
hc_fclose (&outfile_ctx->fp);
|
hc_fclose (&outfile_ctx->fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user