From owner-freebsd-current Sun May 19 12:51:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id B6DA837B40D; Sun, 19 May 2002 12:51:15 -0700 (PDT) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 19 May 2002 20:51:14 +0100 (BST) Date: Sun, 19 May 2002 20:51:14 +0100 From: David Malone To: John De Boskey Cc: Current List Subject: Re: Inetd configuration message logging (or lack thereof) Message-ID: <20020519195114.GA32879@walton.maths.tcd.ie> References: <20020518185131.A86082@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020518185131.A86082@FreeBSD.org> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, May 18, 2002 at 06:51:31PM -0700, John De Boskey wrote: > Comments on the following patch. The messages > are invisible with a default install. This patch > gets them into /var/log/messages where they can be > seen. I have a different fix for this at home, included below. It uses syslog's LOG_PERROR flag when initially calling openlog. It then reopens the log without the LOG_PERROR when/if it becomes a daemon. David. diff -u -r1.96 inetd.c --- inetd.c 8 May 2002 17:20:08 -0000 1.96 +++ inetd.c 13 May 2002 23:02:35 -0000 @@ -317,7 +317,7 @@ const char *servname; int error; - openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); + openlog("inetd", LOG_PID | LOG_NOWAIT | LOG_PERROR, LOG_DAEMON); while ((ch = getopt(argc, argv, "dlwWR:a:c:C:p:")) != -1) switch(ch) { @@ -434,6 +434,9 @@ if (daemon(0, 0) < 0) { syslog(LOG_WARNING, "daemon(0,0) failed: %m"); } + /* From now on we don't want syslog messages going to stderr. */ + closelog(); + openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); /* * In case somebody has started inetd manually, we need to * clear the logname, so that old servers run as root do not To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message