Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107265751
D41380.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D41380.diff
View Options
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -154,7 +154,6 @@
static const char *ConfFile = _PATH_LOGCONF;
static const char *PidFile = _PATH_LOGPID;
-static const char ctty[] = _PATH_CONSOLE;
static const char include_str[] = "include";
static const char include_ext[] = ".conf";
@@ -800,6 +799,12 @@
if (Sflag == 0)
addsock(_PATH_LOG_PRIV, NULL, S_IRUSR | S_IWUSR);
+ consfile.f_type = F_CONSOLE;
+ consfile.f_file = -1;
+ (void)strlcpy(consfile.fu_fname, _PATH_CONSOLE + sizeof(_PATH_DEV) - 1,
+ sizeof(consfile.fu_fname));
+ (void)strlcpy(bootfile, getbootfile(), sizeof(bootfile));
+
if ((!Foreground) && (!Debug)) {
ppid = waitdaemon(30);
if (ppid < 0) {
@@ -810,11 +815,6 @@
} else if (Debug)
setlinebuf(stdout);
- consfile.f_type = F_CONSOLE;
- (void)strlcpy(consfile.fu_fname, ctty + sizeof(_PATH_DEV) - 1,
- sizeof(consfile.fu_fname));
- (void)strlcpy(bootfile, getbootfile(), sizeof(bootfile));
-
kq = kqueue();
if (kq == -1) {
warn("failed to initialize kqueue");
@@ -1651,20 +1651,9 @@
/* log the message to the particular outputs */
if (!Initialized) {
- f = &consfile;
- /*
- * Open in non-blocking mode to avoid hangs during open
- * and close(waiting for the port to drain).
- */
- f->f_file = open(ctty, O_WRONLY | O_NONBLOCK, 0);
-
- if (f->f_file >= 0) {
- f->f_lasttime = *timestamp;
- fprintlog_first(f, hostname, app_name, procid, msgid,
- structured_data, msg, flags);
- close(f->f_file);
- f->f_file = -1;
- }
+ consfile.f_lasttime = *timestamp;
+ fprintlog_first(&consfile, hostname, app_name, procid,
+ msgid, structured_data, msg, flags);
return;
}
@@ -3049,12 +3038,15 @@
if (syncfile)
f->f_flags |= FFLAG_SYNC;
if (isatty(f->f_file)) {
- if (strcmp(p, ctty) == 0)
+ if (strcmp(p, _PATH_CONSOLE) == 0)
f->f_type = F_CONSOLE;
else
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;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 8:03 PM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15772547
Default Alt Text
D41380.diff (2 KB)
Attached To
Mode
D41380: syslogd: Do not open console descriptor
Attached
Detach File
Event Timeline
Log In to Comment