chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
macro: rework how we define cleanup macros
[elogind.git]
/
src
/
shared
/
logs-show.c
diff --git
a/src/shared/logs-show.c
b/src/shared/logs-show.c
index 43386841bafba8b95360969e0ac100f57a1104d8..570032121540ab3175d8456cd5a0679a7db8a7df 100644
(file)
--- a/
src/shared/logs-show.c
+++ b/
src/shared/logs-show.c
@@
-30,6
+30,7
@@
#include "util.h"
#include "utf8.h"
#include "hashmap.h"
#include "util.h"
#include "utf8.h"
#include "hashmap.h"
+#include "journal-internal.h"
#define PRINT_THRESHOLD 128
#define JSON_THRESHOLD 4096
#define PRINT_THRESHOLD 128
#define JSON_THRESHOLD 4096
@@
-941,7
+942,7
@@
int show_journal_by_unit(
OutputFlags flags,
bool system) {
OutputFlags flags,
bool system) {
- sd_journal *j = NULL;
+ sd_journal
_cleanup_journal_close_
*j = NULL;
int r;
int jflags = SD_JOURNAL_LOCAL_ONLY | system * SD_JOURNAL_SYSTEM_ONLY;
int r;
int jflags = SD_JOURNAL_LOCAL_ONLY | system * SD_JOURNAL_SYSTEM_ONLY;
@@
-954,24
+955,20
@@
int show_journal_by_unit(
r = sd_journal_open(&j, jflags);
if (r < 0)
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)
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)
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] = {
}
static const char *const output_mode_table[_OUTPUT_MODE_MAX] = {