summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-05 00:52:47 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-05 01:40:51 +0100
commit2cf4172a71860c6e44edd27a3b68047ae062d7fc (patch)
treef55e2a8c0eff662d0ab7471ef8ac2526fe19ed36 /src/journal
parentb798e7baa5dc3ca6199bbff69f71a08d94299fdd (diff)
journal: install sigbus handler for journal tools too
This makes them robust regarding truncation. Ideally, we'd export this as an API, but given how messy SIGBUS handling is, and the uncertain ownership logic of signal handlers we should not do this (unless libc one day invents a scheme how to sanely install SIGBUS handlers for specific memory areas only). However, for now we can still make all our own tools robust. Note that external tools will only have read-access to the journal anyway, where SIGBUS is much more unlikely, given that only writes are subject to disk full problems.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/coredumpctl.c6
-rw-r--r--src/journal/journalctl.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index a6551ac44..8ebca4f51 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -26,8 +26,7 @@
#include <fcntl.h>
#include <unistd.h>
-#include "systemd/sd-journal.h"
-
+#include "sd-journal.h"
#include "build.h"
#include "set.h"
#include "util.h"
@@ -38,6 +37,7 @@
#include "journal-internal.h"
#include "copy.h"
#include "compress.h"
+#include "sigbus.h"
static enum {
ACTION_NONE,
@@ -803,6 +803,8 @@ int main(int argc, char *argv[]) {
if (arg_action == ACTION_NONE)
goto end;
+ sigbus_install();
+
r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
if (r < 0) {
log_error_errno(r, "Failed to open journal: %m");
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 7b67bc1da..c91f2cf93 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -54,6 +54,7 @@
#include "pager.h"
#include "strv.h"
#include "set.h"
+#include "sigbus.h"
#include "journal-internal.h"
#include "journal-def.h"
#include "journal-verify.h"
@@ -1723,6 +1724,7 @@ int main(int argc, char *argv[]) {
goto finish;
signal(SIGWINCH, columns_lines_cache_reset);
+ sigbus_install();
if (arg_action == ACTION_NEW_ID128) {
r = generate_new_id128();