1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-04 17:47:03 +03:00

sd-journal: make sure it's safe to call sd_journal_process() before the first sd_journal_wait()

In that case we have no inotify fd yet, and there's nothing to process
hence. Let's make the call a NOP.

(Previously, without this change we'd end up trying to read off inotify
fd -1, which is quite a problem... 😢)
This commit is contained in:
Lennart Poettering 2018-02-09 22:38:46 +01:00
parent 47c073aa82
commit 10c4d6405f

View File

@ -2540,6 +2540,9 @@ _public_ int sd_journal_process(sd_journal *j) {
assert_return(j, -EINVAL);
assert_return(!journal_pid_changed(j), -ECHILD);
if (j->inotify_fd < 0) /* We have no inotify fd yet? Then there's noting to process. */
return 0;
j->last_process_usec = now(CLOCK_MONOTONIC);
j->last_invalidate_counter = j->current_invalidate_counter;