From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/602 Path: main.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: supervising postfix Date: Sat, 16 Oct 2004 16:42:30 -0400 (EDT) Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1097959368 25692 80.91.229.6 (16 Oct 2004 20:42:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Oct 2004 20:42:48 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-841-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Oct 16 22:42:36 2004 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14] ident=qmailr) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1CIvNs-0000DK-00 for ; Sat, 16 Oct 2004 22:42:36 +0200 Original-Received: (qmail 5210 invoked by uid 76); 16 Oct 2004 20:42:57 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 5204 invoked from network); 16 Oct 2004 20:42:57 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com Original-To: Vincent Danen In-Reply-To: Xref: main.gmane.org gmane.comp.sysutils.supervision.general:602 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:602 On Sat, 16 Oct 2004, Charlie Brady wrote: > I don't see the logic in postfix interpreting this as a fatal error. > Postfix wanted to be the process group leader. It already was. Where's > the fatal problem? I notice that elsewhere in postfix (in pipe_command.c) setsid failure is not fatal: ... /* * Child. Run the child in a separate process group so that the * parent can kill not just the child but also its offspring. */ case 0: set_ugid(args.uid, args.gid); if (setsid() < 0) msg_warn("setsid failed: %m"); ... You could do the same in master.c: ... /* * Run in a separate process group, so that "postfix stop" can terminate * all MTA processes cleanly. Give up if we can't separate from our * parent process. We're not supposed to blow away the parent. */ if (setsid() == -1) msg_fatal("unable to set session and process group ID: %m"); ... The comment of course is bogus, one wouldn't blow away the parent if setsid() fails, since that implies the parent is already in a separate process group. BTW, don't expect to use multilog with postfix: ... /* * If started from a terminal, get rid of any tty association. This also * means that all errors and warnings must go to the syslog daemon. */ for (fd = 0; fd < 3; fd++) { (void) close(fd); if (open("/dev/null", O_RDWR, 0) != fd) msg_fatal("open /dev/null: %m"); } ... The comment there is also bogus, since there is not test for being started from a terminal. --- Charlie