Skip to content

Commit

Permalink
Core bugfix: ReloadAtDone would not trigger from child processes
Browse files Browse the repository at this point in the history
  • Loading branch information
magnumripper committed Mar 10, 2023
1 parent 7ca85e8 commit 0e339aa
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/john.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static int john_omp_threads_new;
#include "omp_autotune.h"

extern int dynamic_Register_formats(struct fmt_main **ptr);

#if CPU_DETECT
extern int CPU_detect(void);
extern char CPU_req_name[];
Expand Down Expand Up @@ -651,20 +651,23 @@ static void john_set_mpi(void)

static void john_wait(void)
{
log_flush();

/* Tell our friends there is nothing more to crack! */
if (!database.password_count && !options.reload_at_crack &&
cfg_get_bool(SECTION_OPTIONS, NULL, "ReloadAtDone", 1))
raise(SIGUSR2);

if (!john_main_process)
return;

int waiting_for = john_child_count;

log_event("Waiting for %d child%s to terminate",
waiting_for, waiting_for == 1 ? "" : "ren");
fprintf(stderr, "Waiting for %d child%s to terminate\n",
waiting_for, waiting_for == 1 ? "" : "ren");

log_flush();

/* Tell our friends there is nothing more to crack! */
if (!database.password_count && !options.reload_at_crack &&
cfg_get_bool(SECTION_OPTIONS, NULL, "ReloadAtDone", 0))
raise(SIGUSR2);

/*
* Although we may block on wait(2), we still have signal handlers and a timer
* in place, so we're relaying keypresses to child processes via signals.
Expand Down Expand Up @@ -1849,7 +1852,7 @@ static void john_run(void)
mask_destroy();

#if OS_FORK
if (options.fork && john_main_process)
if (options.fork)
john_wait();
#endif

Expand Down

0 comments on commit 0e339aa

Please sign in to comment.