diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-11-03 18:40:36 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-11-03 18:40:36 +0000 |
commit | 435a5f2e21173a82a2347aabc6eb29cf2d0eb705 (patch) | |
tree | 9abdcc71ea95835f11db65d0a635f60251d733a6 | |
parent | 09eeeff95edfcc5c91de9009db50bc491be6d3b2 (diff) | |
download | mailfromd-435a5f2e21173a82a2347aabc6eb29cf2d0eb705.tar.gz mailfromd-435a5f2e21173a82a2347aabc6eb29cf2d0eb705.tar.bz2 |
(check_portspec): Minor fix: no use to make sp
static.
(mailfromd_daemon): Stop on SIGTERM, SIGQUIT, SIGHUP and SIGINT.
Finally!
git-svn-id: file:///svnroot/mailfromd/trunk@776 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | src/engine.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/engine.c b/src/engine.c index 88f8f73c..86dd5d1c 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1168,12 +1168,13 @@ check_portspec(char *portspec) static struct spectab { char *proto; void (*check)(char *); - } *sp, spectab[] = { + } spectab[] = { { "unix", check_local_portspec }, { "local", check_local_portspec }, { "inet", NULL }, { "inet6", NULL }, }; + struct spectab *sp; if (strchr(portspec, ':') == NULL) { mu_error("Missing protocol in port specification"); @@ -1183,7 +1184,7 @@ check_portspec(char *portspec) for (sp = spectab; sp < spectab + sizeof(spectab)/sizeof(spectab[0]); sp++) { int len = strlen(sp->proto); - if (strlen(portspec) > len+1 + if (strlen(portspec) > len + 1 && strncasecmp(portspec, sp->proto, len) == 0 && portspec[len] == ':') { if (sp->check) @@ -1194,6 +1195,12 @@ check_portspec(char *portspec) mu_error("Unknown port specification: %s", portspec); } +static RETSIGTYPE +sig_stop(int sig) +{ + smfi_stop(); +} + void mailfromd_daemon() { @@ -1216,6 +1223,10 @@ mailfromd_daemon() exit(EX_UNAVAILABLE); } + signal(SIGTERM, sig_stop); + signal(SIGQUIT, sig_stop); + signal(SIGHUP, sig_stop); + signal(SIGINT, sig_stop); if (!foreground) { if (daemon(0, 0) == -1) { mu_error("cannot become a daemon: %s", |