diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-11-23 12:03:47 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-11-23 12:03:47 +0000 |
commit | 45fb5a0791f876cb1480d3b5574c2541d1cd65f7 (patch) | |
tree | 4f66034230e5fd6640bf9e09f58e49b21f022a64 /usr.sbin/smtpd | |
parent | 9725ed6e5ef5757f2080bd77f7fb2596a2bb5a29 (diff) |
In "smtpd; smtpd;" the second instance would fatal quickly, but it would
remove the smtpd.sock file, without which /usr/sbin/sendmail will fail
causing mails to be queued in offline.
Initially reported by ian@, may explain oga@'s e-mail burst after smtpd
restart.
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/control.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 4a5768aa178..09eabf18a53 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.39 2009/10/25 19:46:31 gilles Exp $ */ +/* $OpenBSD: control.c,v 1.40 2009/11/23 12:03:46 jacekm Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -111,11 +111,15 @@ control(struct smtpd *env) if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) fatal("control: socket"); + bzero(&sun, sizeof(sun)); sun.sun_family = AF_UNIX; if (strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) fatal("control: socket name too long"); + if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == 0) + fatalx("control socket already listening"); + if (unlink(SMTPD_SOCKET) == -1) if (errno != ENOENT) fatal("control: cannot unlink socket"); |