Fix missing hc_unlockfile()

pull/2387/head
Jens Steube 4 years ago
parent 1da40bf5d8
commit f1d4260983

@ -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);
}

@ -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;

@ -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);

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

@ -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;
}

@ -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);
}

@ -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;
}

Loading…
Cancel
Save