1
mirror of https://github.com/hashcat/hashcat synced 2024-12-12 17:13:55 +01:00

Merge pull request #895 from magnumripper/master

Only lock loopback and pot files while actually writing to them.
This commit is contained in:
Jens Steube 2016-12-02 14:34:05 +01:00 committed by GitHub
commit ebcb23cc57
2 changed files with 8 additions and 18 deletions

View File

@ -112,15 +112,6 @@ int loopback_write_open (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (lock_file (fp) == -1)
{
fclose (fp);
event_log_error (hashcat_ctx, "%s: %s", loopback_ctx->filename, strerror (errno));
return -1;
}
loopback_ctx->fp = fp;
loopback_ctx->unused = true;
@ -165,9 +156,13 @@ void loopback_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ptr, con
loopback_format_plain (hashcat_ctx, plain_ptr, plain_len);
lock_file (fp);
fwrite (EOL, strlen (EOL), 1, fp);
fflush (fp);
unlock_file (fp);
loopback_ctx->unused = false;
}

View File

@ -184,15 +184,6 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (lock_file (fp) == -1)
{
fclose (fp);
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
return -1;
}
potfile_ctx->fp = fp;
return 0;
@ -260,9 +251,13 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *
tmp_buf[tmp_len] = 0;
lock_file (potfile_ctx->fp);
fprintf (potfile_ctx->fp, "%s" EOL, tmp_buf);
fflush (potfile_ctx->fp);
unlock_file (potfile_ctx->fp);
}
int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)