Mercurial > dnsbl
diff src/dnsbl.cpp @ 22:c21b888cc175 stable-2-2
fix restart code, add ifdef for linux pid issues
author | carl |
---|---|
date | Sat, 01 May 2004 07:44:51 -0700 |
parents | 041ea016b684 |
children | 06de5ab6a232 |
line wrap: on
line diff
--- 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);