chiark / gitweb /
journal: install sigbus handler for journal tools too
[elogind.git] / src / journal / journalctl.c
index 3cec9a0c84e936e8d720873bf78983cdb76d3704..c91f2cf93845e06a33d4c5a79adf08c3f32c0c07 100644 (file)
@@ -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"
@@ -1406,17 +1407,15 @@ static int setup_keys(void) {
         h.fsprg_secpar = htole16(FSPRG_RECOMMENDED_SECPAR);
         h.fsprg_state_size = htole64(state_size);
 
-        l = loop_write(fd, &h, sizeof(h), false);
-        if (l < 0 || (size_t) l != sizeof(h)) {
-                log_error_errno(EIO, "Failed to write header: %m");
-                r = -EIO;
+        r = loop_write(fd, &h, sizeof(h), false);
+        if (r < 0) {
+                log_error_errno(r, "Failed to write header: %m");
                 goto finish;
         }
 
-        l = loop_write(fd, state, state_size, false);
-        if (l < 0 || (size_t) l != state_size) {
-                log_error_errno(EIO, "Failed to write state: %m");
-                r = -EIO;
+        r = loop_write(fd, state, state_size, false);
+        if (r < 0) {
+                log_error_errno(r, "Failed to write state: %m");
                 goto finish;
         }
 
@@ -1693,7 +1692,7 @@ static int flush_to_var(void) {
                         break;
 
                 if (errno != ENOENT)
-                        return log_error_errno(errno, "Failed to check for existance of /run/systemd/journal/flushed: %m");
+                        return log_error_errno(errno, "Failed to check for existence of /run/systemd/journal/flushed: %m");
 
                 r = fd_wait_for_event(watch_fd, POLLIN, USEC_INFINITY);
                 if (r < 0)
@@ -1725,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();