1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 14:48:12 +00:00

Fix missing hc_unlockfile()

This commit is contained in:
Jens Steube 2020-02-29 10:40:47 +01:00
parent 1da40bf5d8
commit f1d4260983
7 changed files with 34 additions and 5 deletions

View File

@ -141,6 +141,8 @@ void debugfile_destroy (hashcat_ctx_t *hashcat_ctx)
if (debugfile_ctx->filename)
{
hc_unlockfile (&debugfile_ctx->fp);
hc_fclose (&debugfile_ctx->fp);
}

View File

@ -217,6 +217,15 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx)
hc_fwrite (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, &fp);
if (hc_unlockfile (&fp) == -1)
{
hc_fclose (&fp);
event_log_error (hashcat_ctx, "%s: %s", dictstat_ctx->filename, strerror (errno));
return -1;
}
hc_fclose (&fp);
return 0;

View File

@ -258,6 +258,18 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
hc_fflush (&fp);
if (hc_unlockfile (&fp) == -1)
{
hc_fclose (&fp);
event_log_error (hashcat_ctx, "%s: %s", new_hashfile, strerror (errno));
free (new_hashfile);
free (old_hashfile);
return -1;
}
hc_fclose (&fp);
unlink (old_hashfile);

View File

@ -66,6 +66,8 @@ void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
hc_fflush (&fp);
hc_unlockfile (&fp);
hc_fclose (&fp);
}

View File

@ -158,10 +158,7 @@ void loopback_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ptr, con
hc_fflush (&loopback_ctx->fp);
if (hc_unlockfile (&loopback_ctx->fp))
{
event_log_error (hashcat_ctx, "%s: Failed to unlock file", loopback_ctx->filename);
}
hc_unlockfile (&loopback_ctx->fp);
loopback_ctx->unused = false;
}

View File

@ -533,6 +533,8 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx)
if (outfile_ctx->fp.pfp == NULL) return;
hc_unlockfile (&outfile_ctx->fp);
hc_fclose (&outfile_ctx->fp);
}

View File

@ -291,7 +291,12 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
out_flush (&out);
if (filename) hc_fclose (&out.fp);
if (filename)
{
hc_unlockfile (&out.fp);
hc_fclose (&out.fp);
}
return 0;
}