1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

journal: use cleanup attribute at one more place

This commit is contained in:
Yu Watanabe 2019-05-28 18:07:01 +09:00
parent c377a6f3ad
commit 627df1dc42
2 changed files with 4 additions and 5 deletions

View File

@ -145,6 +145,7 @@ int journal_file_open(
int journal_file_set_offline(JournalFile *f, bool wait);
bool journal_file_is_offlining(JournalFile *f);
JournalFile* journal_file_close(JournalFile *j);
DEFINE_TRIVIAL_CLEANUP_FUNC(JournalFile*, journal_file_close);
int journal_file_open_reliably(
const char *fname,

View File

@ -255,7 +255,7 @@ static int open_journal(
JournalMetrics *metrics,
JournalFile **ret) {
JournalFile *f;
_cleanup_(journal_file_closep) JournalFile *f = NULL;
int r;
assert(s);
@ -273,12 +273,10 @@ static int open_journal(
return r;
r = journal_file_enable_post_change_timer(f, s->event, POST_CHANGE_TIMER_INTERVAL_USEC);
if (r < 0) {
(void) journal_file_close(f);
if (r < 0)
return r;
}
*ret = f;
*ret = TAKE_PTR(f);
return r;
}