summaryrefslogtreecommitdiffstats
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-16 08:54:36 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-16 09:03:41 +0100
commitb6cdfbe5c4ee1e3f262665d5434212767799e6da (patch)
tree2b92c47667343a845f3e9c5f0fc98a6811e4e8d3 /src/journal
parentjournal-file: get rid of a helper variable (diff)
downloadsystemd-b6cdfbe5c4ee1e3f262665d5434212767799e6da.tar.xz
systemd-b6cdfbe5c4ee1e3f262665d5434212767799e6da.zip
journal: simplify use of sd_event_source_get_enabled()
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-file.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index ea1e450344..390996a815 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -349,11 +349,8 @@ JournalFile* journal_file_close(JournalFile *f) {
#endif
if (f->post_change_timer) {
- int enabled;
-
- if (sd_event_source_get_enabled(f->post_change_timer, &enabled) >= 0)
- if (enabled == SD_EVENT_ONESHOT)
- journal_file_post_change(f);
+ if (sd_event_source_get_enabled(f->post_change_timer, NULL) > 0)
+ journal_file_post_change(f);
(void) sd_event_source_set_enabled(f->post_change_timer, SD_EVENT_OFF);
sd_event_source_unref(f->post_change_timer);
@@ -1869,19 +1866,18 @@ static int post_change_thunk(sd_event_source *timer, uint64_t usec, void *userda
}
static void schedule_post_change(JournalFile *f) {
- int enabled, r;
uint64_t now;
+ int r;
assert(f);
assert(f->post_change_timer);
- r = sd_event_source_get_enabled(f->post_change_timer, &enabled);
+ r = sd_event_source_get_enabled(f->post_change_timer, NULL);
if (r < 0) {
log_debug_errno(r, "Failed to get ftruncate timer state: %m");
goto fail;
}
-
- if (enabled == SD_EVENT_ONESHOT)
+ if (r > 0)
return;
r = sd_event_now(sd_event_source_get_event(f->post_change_timer), CLOCK_MONOTONIC, &now);