Skip to content

Commit bb41688

Browse files
committed
Fix "going to invoke program before killing: (null)"
1 parent 3b1a679 commit bb41688

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

kill.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ static void notify_process_killed(const poll_loop_args_t* args, const procinfo_t
210210
// "-P" option
211211
static void kill_process_prehook(const poll_loop_args_t* args, const procinfo_t* victim)
212212
{
213-
if (!args->kill_process_prehook) {
214-
return;
215-
}
216213
char* const argv[] = {
217214
args->kill_process_prehook,
218215
NULL,
@@ -629,7 +626,7 @@ void kill_process(const poll_loop_args_t* args, int sig, const procinfo_t* victi
629626
// Invoke program BEFORE killing a process. There is a small risk that there
630627
// is not enough memory to spawn it, warn; and a brief period of sleep to
631628
// let the program be able to start and do something meaningful.
632-
if (sig != 0) {
629+
if (sig != 0 && args->kill_process_prehook) {
633630
warn("going to invoke program before killing: %s\n", args->kill_process_prehook);
634631
kill_process_prehook(args, victim);
635632
}

0 commit comments

Comments
 (0)