summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Schlüßler <schluessler@krause.de>2020-01-13 10:09:45 +0100
committerLennart Poettering <lennart@poettering.net>2020-01-13 17:33:50 +0100
commit3ac9cac7f7a34c3713b49841ee75ef9c9357e7e4 (patch)
tree89dfa68e3b90d185f0154dfe69d9278925ac2a11 /src
parentMerge pull request #14532 from poettering/namespace-dynamic-user-fix (diff)
downloadsystemd-3ac9cac7f7a34c3713b49841ee75ef9c9357e7e4.tar.xz
systemd-3ac9cac7f7a34c3713b49841ee75ef9c9357e7e4.zip
journalctl: Correctly handle --show-cursor in combination with --until or --since and --reverse
Diffstat (limited to 'src')
-rw-r--r--src/journal/journalctl.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 95b6bfee17..c0916f372f 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2514,7 +2514,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
if (usec > arg_until)
- goto finish;
+ break;
}
if (arg_since_set && arg_reverse) {
@@ -2526,7 +2526,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
if (usec < arg_since)
- goto finish;
+ break;
}
if (!arg_merge && !arg_quiet) {
@@ -2632,29 +2632,6 @@ int main(int argc, char *argv[]) {
if (!arg_follow) {
if (n_shown == 0 && !arg_quiet)
printf("-- No entries --\n");
-
- if (arg_show_cursor || arg_cursor_file) {
- _cleanup_free_ char *cursor = NULL;
-
- r = sd_journal_get_cursor(j, &cursor);
- if (r < 0 && r != -EADDRNOTAVAIL)
- log_error_errno(r, "Failed to get cursor: %m");
- else if (r >= 0) {
- if (arg_show_cursor)
- printf("-- cursor: %s\n", cursor);
-
- if (arg_cursor_file) {
- r = write_string_file(arg_cursor_file, cursor,
- WRITE_STRING_FILE_CREATE |
- WRITE_STRING_FILE_ATOMIC);
- if (r < 0)
- log_error_errno(r,
- "Failed to write new cursor to %s: %m",
- arg_cursor_file);
- }
- }
- }
-
break;
}
@@ -2667,6 +2644,28 @@ int main(int argc, char *argv[]) {
first_line = false;
}
+ if (arg_show_cursor || arg_cursor_file) {
+ _cleanup_free_ char *cursor = NULL;
+
+ r = sd_journal_get_cursor(j, &cursor);
+ if (r < 0 && r != -EADDRNOTAVAIL)
+ log_error_errno(r, "Failed to get cursor: %m");
+ else if (r >= 0) {
+ if (arg_show_cursor)
+ printf("-- cursor: %s\n", cursor);
+
+ if (arg_cursor_file) {
+ r = write_string_file(arg_cursor_file, cursor,
+ WRITE_STRING_FILE_CREATE |
+ WRITE_STRING_FILE_ATOMIC);
+ if (r < 0)
+ log_error_errno(r,
+ "Failed to write new cursor to %s: %m",
+ arg_cursor_file);
+ }
+ }
+ }
+
finish:
pager_close();