diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-17 23:36:25 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-18 19:49:30 -0400 |
commit | 763c7aa288485cf5ab627fe1d25ff58e76f9dacb (patch) | |
tree | 563130863f8763af93df272c0122c76ef25aaba0 /src/shared/logs-show.c | |
parent | a50d7d4389217c0d3b527ee260eabf89e4a76caa (diff) |
journal,shared: add _cleanup_journal_close_
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r-- | src/shared/logs-show.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 43386841ba..8897a10c2b 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -941,7 +941,7 @@ int show_journal_by_unit( 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; @@ -954,24 +954,20 @@ int show_journal_by_unit( 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] = { |