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
..
2004-01-21 13:38:17 +00:00
2004-04-13 19:31:21 +00:00
2004-04-13 19:31:21 +00:00
2003-09-07 16:43:53 +00:00
2004-05-13 21:55:53 +00:00
2003-07-06 12:44:11 +00:00
2004-01-04 15:51:32 +00:00
2003-04-04 17:49:21 +00:00
2004-05-25 10:43:46 +00:00
2002-07-14 14:47:15 +00:00
2004-03-28 13:42:27 +00:00
2004-03-28 13:42:27 +00:00
2004-03-28 13:42:27 +00:00
2004-05-29 06:10:42 +00:00
2003-06-11 21:37:19 +00:00
2002-07-14 14:47:15 +00:00
2002-07-14 14:47:15 +00:00
2002-11-27 15:31:08 +00:00
2004-02-23 20:25:27 +00:00
2004-02-23 20:25:27 +00:00
2004-03-27 14:23:25 +00:00
2003-07-06 12:44:11 +00:00
2003-08-04 21:31:53 +00:00
2003-04-04 17:49:21 +00:00
2004-02-23 20:25:27 +00:00
2003-04-04 17:49:21 +00:00
2004-05-22 17:06:54 +00:00
2003-04-29 19:53:00 +00:00
2002-07-14 14:47:15 +00:00
2004-03-26 09:28:03 +00:00
2002-07-14 14:47:15 +00:00
2004-04-04 19:46:14 +00:00
2003-10-29 09:31:41 +00:00
2003-10-26 10:30:17 +00:00
2004-03-10 08:46:39 +00:00
2003-07-06 12:44:11 +00:00
2004-03-17 20:10:59 +00:00
2003-02-24 22:53:26 +00:00
2002-07-14 14:47:15 +00:00
2003-06-04 15:58:03 +00:00
2004-02-04 21:59:29 +00:00
2002-07-28 02:27:07 +00:00
2003-10-25 22:03:10 +00:00
2003-10-05 12:09:31 +00:00
2004-01-21 14:01:29 +00:00
2003-06-04 19:24:24 +00:00
2003-04-04 17:49:21 +00:00
2003-08-16 19:59:53 +00:00
2004-05-23 18:30:08 +00:00