Date: Sat, 29 May 2004 17:02:19 -0700 (PDT) From: David Malone <dwmalone@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/usr.sbin/syslogd syslogd.c Message-ID: <200405300002.i4U02Jvl064022@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405300002.i4U02Jvl064022>