summaryrefslogtreecommitdiff
path: root/src/journal/journald.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-01 01:06:10 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-01 17:27:16 +0200
commit0d9243f022d244632b1ab26cfc8b46794b7fc5d6 (patch)
tree043222060732d6087d8ba684884456424a4f7660 /src/journal/journald.c
parent01cf0ca850dd1c21e1c405a4493fe61d0c28d721 (diff)
journal: support changing the console tty to forward to
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r--src/journal/journald.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index e0e7cce122..0e27582df3 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -965,6 +965,7 @@ static void forward_console(Server *s, const char *identifier, const char *messa
char header_pid[16];
int n = 0, fd;
char *ident_buf = NULL;
+ const char *tty;
assert(s);
assert(message);
@@ -992,14 +993,16 @@ static void forward_console(Server *s, const char *identifier, const char *messa
IOVEC_SET_STRING(iovec[n++], message);
IOVEC_SET_STRING(iovec[n++], "\n");
- fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ tty = s->tty_path ? s->tty_path : "/dev/console";
+
+ fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (fd < 0) {
- log_debug("Failed to open /dev/console for logging: %s", strerror(errno));
+ log_debug("Failed to open %s for logging: %s", tty, strerror(errno));
goto finish;
}
if (writev(fd, iovec, n) < 0)
- log_debug("Failed to write to /dev/console for logging: %s", strerror(errno));
+ log_debug("Failed to write to %s for logging: %s", tty, strerror(errno));
close_nointr_nofail(fd);
@@ -2782,6 +2785,7 @@ static void server_done(Server *s) {
journal_rate_limit_free(s->rate_limit);
free(s->buffer);
+ free(s->tty_path);
}
int main(int argc, char *argv[]) {