mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 18:56:38 +00:00
syslogd: Keep console and tty descriptors open
Console and tty descriptors are initially opened in parse_action() to
determine whether they are valid using isatty(). That descriptor is then
closed because it is never accessed by syslogd again; ttymsg() will reopen
the tty/console under a new descriptor when needed.
If the user attempts to log to a tty that is inactive outside of
syslogd, then syslogd must keep that descriptor open so the tty remains
accessible. For example, logging to `/dev/ttyvb` requires the initial
`/dev/ttyvb` descriptor to stay open so the user can view its buffer at
any time via CTRL+ALT+F12.
As a result, console and tty descriptors must remain open until a
potential configuration reload or a system shutdown. The given
descriptor will be closed in close_filed() in such circumstances.
PR: 274454
Fixes: c3175a6e1c
("syslogd: Do not open console descriptor")
Reported by: Trond Endrestøl <Trond.Endrestol@ximalas.info>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D42215
This commit is contained in:
parent
7ef6e99752
commit
d556719e15
|
@ -3053,9 +3053,6 @@ parse_action(const char *p, struct filed *f)
|
|||
f->f_type = F_TTY;
|
||||
(void)strlcpy(f->fu_fname, p + sizeof(_PATH_DEV) - 1,
|
||||
sizeof(f->fu_fname));
|
||||
/* This will be reopened by ttymsg(). */
|
||||
close(f->f_file);
|
||||
f->f_file = -1;
|
||||
} else {
|
||||
(void)strlcpy(f->fu_fname, p, sizeof(f->fu_fname));
|
||||
f->f_type = F_FILE;
|
||||
|
|
Loading…
Reference in a new issue