summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-09 09:57:29 +0200
committerDaniel Mack <github@zonque.org>2015-09-09 09:57:29 +0200
commit0fa7d1f5be847d4804eb3bf6a4c10333ea14e0bc (patch)
tree6afb70cc560bd94219f81495ff699c83b404e18c /src/journal
parentbed2c013b6570908a114a337632000cf9c9de838 (diff)
parentece174c5439021e32ebcc858842de9586072c006 (diff)
Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/cat.c3
-rw-r--r--src/journal/coredumpctl.c7
-rw-r--r--src/journal/journal-verify.c10
-rw-r--r--src/journal/journalctl.c6
-rw-r--r--src/journal/journald-audit.c3
-rw-r--r--src/journal/test-journal-verify.c3
6 files changed, 12 insertions, 20 deletions
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 2e236f0004..be2c2e3354 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -142,8 +142,7 @@ int main(int argc, char *argv[]) {
if (dup3(fd, STDOUT_FILENO, 0) < 0 ||
dup3(fd, STDERR_FILENO, 0) < 0) {
- log_error_errno(errno, "Failed to duplicate fd: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to duplicate fd: %m");
goto finish;
}
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 644ba91b0d..0fa427003b 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -631,8 +631,8 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
sz = write(fdt, data, len);
if (sz < 0) {
- log_error_errno(errno, "Failed to write temporary file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to write temporary file: %m");
goto error;
}
if (sz != (ssize_t) len) {
@@ -758,8 +758,7 @@ static int run_gdb(sd_journal *j) {
pid = fork();
if (pid < 0) {
- log_error_errno(errno, "Failed to fork(): %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to fork(): %m");
goto finish;
}
if (pid == 0) {
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index eaf006db7a..00f70d3a53 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -839,22 +839,20 @@ int journal_file_verify(
data_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (data_fd < 0) {
- log_error_errno(errno, "Failed to create data file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to create data file: %m");
goto fail;
}
entry_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (entry_fd < 0) {
- log_error_errno(errno, "Failed to create entry file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to create entry file: %m");
goto fail;
}
entry_array_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (entry_array_fd < 0) {
- log_error_errno(errno, "Failed to create entry array file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to create entry array file: %m");
goto fail;
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index ce2dd9da26..d31ab1c6d7 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1428,8 +1428,7 @@ static int setup_keys(void) {
fd = open("/dev/random", O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0) {
- log_error_errno(errno, "Failed to open /dev/random: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to open /dev/random: %m");
goto finish;
}
@@ -1488,8 +1487,7 @@ static int setup_keys(void) {
}
if (link(k, p) < 0) {
- log_error_errno(errno, "Failed to link file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to link file: %m");
goto finish;
}
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
index 83c3332abf..fe8ae194c9 100644
--- a/src/journal/journald-audit.c
+++ b/src/journal/journald-audit.c
@@ -324,10 +324,9 @@ static int map_all_fields(
if (r < 0)
return log_debug_errno(r, "Failed to parse audit array: %m");
- if (r == 0) {
+ if (r == 0)
/* Couldn't process as generic field, let's just skip over it */
p += strcspn(p, WHITESPACE);
- }
}
}
}
diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c
index d24502d9a8..9dd9cb853f 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -118,12 +118,11 @@ int main(int argc, char *argv[]) {
assert_se(journal_file_verify(f, verification_key, &from, &to, &total, true) >= 0);
- if (verification_key && JOURNAL_HEADER_SEALED(f->header)) {
+ if (verification_key && JOURNAL_HEADER_SEALED(f->header))
log_info("=> Validated from %s to %s, %s missing",
format_timestamp(a, sizeof(a), from),
format_timestamp(b, sizeof(b), to),
format_timespan(c, sizeof(c), total > to ? total - to : 0, 0));
- }
journal_file_close(f);