Browse Source

fix: skip send SIGALRM when assets disabled

dev
Dnomd343 2 years ago
parent
commit
2e506a3532
  1. 10
      src/cleardns.c

10
src/cleardns.c

@ -74,8 +74,7 @@ int main(int argc, char *argv[]) { // ClearDNS service
dnsproxy_free(loader.foreign); dnsproxy_free(loader.foreign);
assets_free(loader.resource); assets_free(loader.resource);
if (loader.crond != NULL) { if (loader.crond != NULL) {
process_list_append(crontab_load(loader.crond)); process_list_append(crontab_load(loader.crond)); // free crontab struct later
crontab_free(loader.crond);
} }
if (loader.filter != NULL) { if (loader.filter != NULL) {
process_list_append(adguard_load(loader.filter, ADGUARD_DIR)); process_list_append(adguard_load(loader.filter, ADGUARD_DIR));
@ -89,7 +88,12 @@ int main(int argc, char *argv[]) { // ClearDNS service
string_list_free(loader.script); string_list_free(loader.script);
process_list_run(); process_list_run();
kill(1, SIGALRM); // send alarm signal to itself if (loader.crond != NULL) { // assets not disabled
pid_t my_pid = getpid();
log_info("ClearDNS PID -> %d", my_pid);
kill(my_pid, SIGALRM); // send alarm signal to itself
crontab_free(loader.crond);
}
process_list_daemon(); process_list_daemon();
return 0; return 0;
} }

Loading…
Cancel
Save