freebsd-skq/usr.sbin/syslogd
dwmalone 1b2d9d1890 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
2004-05-30 00:02:19 +00:00
..
Makefile Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
pathnames.h
syslog.conf.5 Allow multiple hosts or programs to be named in program 2003-02-13 00:08:56 +00:00
syslogd.8 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
syslogd.c Try to be more careful about using using the file descriptor f_file. 2004-05-30 00:02:19 +00:00