From owner-cvs-all@FreeBSD.ORG Sat May 29 17:02:20 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F1BB616A4CE; Sat, 29 May 2004 17:02:19 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB02043D31; Sat, 29 May 2004 17:02:19 -0700 (PDT) (envelope-from dwmalone@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i4U02J4h064023; Sat, 29 May 2004 17:02:19 -0700 (PDT) (envelope-from dwmalone@repoman.freebsd.org) Received: (from dwmalone@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i4U02Jvl064022; Sat, 29 May 2004 17:02:19 -0700 (PDT) (envelope-from dwmalone) Message-Id: <200405300002.i4U02Jvl064022@repoman.freebsd.org> From: David Malone Date: Sat, 29 May 2004 17:02:19 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.sbin/syslogd syslogd.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2004 00:02:20 -0000 dwmalone 2004/05/29 17:02:19 PDT FreeBSD src repository Modified files: usr.sbin/syslogd syslogd.c Log: Try to be more careful about using using the file descriptor f_file. Syslogd should ensure that f_file is a valid file descriptor when f_type is FILE, CONSOLE, TTY and for a PIPE where f_pid > 0. If the descriptor is closed/invalid then the type should be set to UNUSED or the pid should be set to 0. To this end: 1) Don't close(f->f_file) if we can't send a message to a remote host because the file descriptor used for remote logging is stored in finet, not in f->f_file. f->f_file is probably uninitialised, so I guess we usually end up closing fd 0. 2) Don't close PIPE file descriptors if they are invalid. 3) If the call to p_open fails, don't set the pid. The OpenBSD patches in this area set f_file to -1 after the fd is closed and then avoids calling close if f_file < 0. I haven't done this, but it might be a good idea too. Inspired by: PR 67139/OpenBSD Revision Changes Path 1.126 +13 -7 src/usr.sbin/syslogd/syslogd.c