Skip to content

Commit

Permalink
implement strtok_r correctly, stop in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
jxmx committed Jan 4, 2025
1 parent db058b9 commit 62bfb89
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/app_rpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,11 +1126,12 @@ static void killpidtree(const int pid_int){
}

if (fgets(buffer, sizeof(buffer), file) != NULL) {
char *child_pid_str = strtok_r(buffer, " ");
char *saveptr;
char *child_pid_str = strtok_r(buffer, " ", &saveptr);
while (child_pid_str != NULL) {
int child_pid_int = atoi(child_pid_str);
killpidtree(child_pid_int);
child_pid_str = strtok_r(NULL, " ");
child_pid_str = strtok_r(NULL, " ", &saveptr);
}
}
fclose(file);
Expand Down Expand Up @@ -7520,7 +7521,6 @@ static int unload_module(void)

daq_uninit();

stopoutstream(&rpt_vars[i]);

stop_repeaters();

Expand All @@ -7544,6 +7544,9 @@ static int unload_module(void)
ast_mutex_lock(&rpt_vars[i].blocklock);
ast_mutex_unlock(&rpt_vars[i].blocklock);
ast_mutex_destroy(&rpt_vars[i].blocklock);

/* Also kill any outstreamcmd fork()s */
stopoutstream(&rpt_vars[i]);
}

res = ast_unregister_application(app);
Expand Down

0 comments on commit 62bfb89

Please sign in to comment.