# HG changeset patch # User carl # Date 1083422691 25200 # Node ID c21b888cc175458213c589ef1ec92d69e6c2f7cf # Parent 19f11ae628df043199bfc73f3b48a977ced05ebf fix restart code, add ifdef for linux pid issues diff -r 19f11ae628df -r c21b888cc175 src/dnsbl.cpp --- a/src/dnsbl.cpp Fri Apr 30 22:50:32 2004 -0700 +++ b/src/dnsbl.cpp Sat May 01 07:44:51 2004 -0700 @@ -1117,13 +1117,25 @@ unlink(pidpath); FILE *f = fopen(pidpath, "w"); if (f) { +#ifdef linux + // from a comment in the DCC source code: + // Linux threads are broken. Signals given the + // original process are delivered to only the + // thread that happens to have that PID. The + // sendmail libmilter thread that needs to hear + // SIGINT and other signals does not, and that breaks + // scripts that need to stop milters. + // However, signaling the process group works. fprintf(f, "-%d\n", (u_int)getpgrp()); +#else + fprintf(f, "%d\n", (u_int)getpid()); +#endif fclose(f); } time_t starting = time(NULL); int rc = smfi_main(); - if (time(NULL) > starting+5*60) { + if ((rc != MI_SUCCESS) && (time(NULL) > starting+5*60)) { my_syslog("trying to restart after smfi_main()"); loader_run = false; // eventually the config loader thread will terminate execvp(argv[0], argv);