summaryrefslogtreecommitdiff
path: root/sys/src/cmd/upas
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-10-23 06:08:18 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-10-23 06:08:18 +0200
commit83fe7aaa5ce4776c394cb9edd89189b62efb89a9 (patch)
treed9a4584c66077f291164b1dcc90d8ac9e7c9d364 /sys/src/cmd/upas
parente3d8fe9d4a1085cbf7237411bcd1996613334994 (diff)
upas/smtpd: don't call syslog() from the note handler, this can deadlock
when the alarm hits while the process is currently in syslog(), holding the sl lock, then calling syslog again will deadlock: /proc/1729193/text:386 plan 9 executable /sys/lib/acid/port /sys/lib/acid/386 acid: lstk() sleep()+0x7 /sys/src/libc/9syscall/sleep.s:5 lock(lk=0x394d8)+0xb7 /sys/src/libc/port/lock.c:25 i=0x3e8 syslog(logname=0x41c64,cons=0x0,fmt=0x41c6a)+0x2d /sys/src/libc/9sys/syslog.c:60 err=0x79732f27 d=0x0 ctim=0x0 buf=0x0 p=0x0 arg=0x0 n=0x0 catchalarm(msg=0xdfffc854)+0x7a /sys/src/cmd/upas/smtp/smtpd.c:71 notifier+0x30 /sys/src/libc/port/atnotify.c:15
Diffstat (limited to 'sys/src/cmd/upas')
-rw-r--r--sys/src/cmd/upas/smtp/smtpd.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/sys/src/cmd/upas/smtp/smtpd.c b/sys/src/cmd/upas/smtp/smtpd.c
index 6c75e9399..93926cdba 100644
--- a/sys/src/cmd/upas/smtp/smtpd.c
+++ b/sys/src/cmd/upas/smtp/smtpd.c
@@ -55,23 +55,12 @@ static int
catchalarm(void*, char *msg)
{
int ign;
- static int chattycathy;
ign = strstr(msg, "closed pipe") != nil;
if(ign)
return 0;
- if(chattycathy++ < 5){
- if(senders.first && rcvers.first)
- syslog(0, "smtpd", "note: %s->%s: %s",
- s_to_c(senders.first->p),
- s_to_c(rcvers.first->p), msg);
- else
- syslog(0, "smtpd", "note: %s", msg);
- }
- if(pp){
+ if(pp)
syskill(pp->pid);
- // pp = 0;
- }
return strstr(msg, "alarm") != nil;
}