#include "util.h"
#include "utf8.h"
#include "hashmap.h"
+#include "journal-internal.h"
#define PRINT_THRESHOLD 128
#define JSON_THRESHOLD 4096
} else if ((flags & OUTPUT_FULL_WIDTH) || (message_len + n + 1 < n_columns))
fprintf(f, ": %s%.*s%s\n", color_on, (int) message_len, message, color_off);
else if (n < n_columns && n_columns - n - 2 >= 3) {
- char _cleanup_free_ *e;
+ _cleanup_free_ char *e;
e = ellipsize_mem(message, message_len, n_columns - n - 2, 90);
const void *data;
size_t length;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
uint64_t realtime;
char ts[FORMAT_TIMESTAMP_MAX];
int r;
char sid[33];
int r;
usec_t realtime, monotonic;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
const void *data;
size_t length;
OutputFlags flags) {
uint64_t realtime, monotonic;
- char _cleanup_free_ *cursor = NULL;
+ _cleanup_free_ char *cursor = NULL;
const void *data;
size_t length;
sd_id128_t boot_id;
OutputFlags flags,
bool system) {
- sd_journal *j = NULL;
+ _cleanup_journal_close_ sd_journal*j = NULL;
int r;
int jflags = SD_JOURNAL_LOCAL_ONLY | system * SD_JOURNAL_SYSTEM_ONLY;
r = sd_journal_open(&j, jflags);
if (r < 0)
- goto finish;
+ return r;
if (system)
r = add_matches_for_unit(j, unit);
else
r = add_matches_for_user_unit(j, unit, uid);
if (r < 0)
- goto finish;
+ return r;
r = show_journal(f, j, mode, n_columns, not_before, how_many, flags);
if (r < 0)
- goto finish;
-
-finish:
- if (j)
- sd_journal_close(j);
+ return r;
- return r;
+ return 0;
}
static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {