summaryrefslogtreecommitdiffstats
path: root/src/journal-remote
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-11-13 20:07:59 +0100
committerLuca Boccassi <luca.boccassi@microsoft.com>2021-11-13 20:11:55 +0100
commit25bb459e3976bff35c86a65887f01ce4a779a3dc (patch)
tree13e5909a948ff2daa2c2a81d0624c78994da2828 /src/journal-remote
parentMerge pull request #21341 from yuwata/network-route-flags (diff)
downloadsystemd-25bb459e3976bff35c86a65887f01ce4a779a3dc.tar.xz
systemd-25bb459e3976bff35c86a65887f01ce4a779a3dc.zip
journal-remote: more handling of sd_event_source_set_enabled failures
But avoid clobbering the return value if it works CID#1465793 CID#1465794
Diffstat (limited to 'src/journal-remote')
-rw-r--r--src/journal-remote/journal-remote.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 0539d4d0bf..9fd6a23076 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -429,9 +429,14 @@ static int dispatch_raw_source_until_block(sd_event_source *event,
sd_event_source_ref(event);
r = journal_remote_handle_raw_source(event, source->importer.fd, EPOLLIN, journal_remote_server_global);
- if (r != 1)
+ if (r != 1) {
+ int k;
+
/* No more data for now */
- sd_event_source_set_enabled(event, SD_EVENT_OFF);
+ k = sd_event_source_set_enabled(event, SD_EVENT_OFF);
+ if (k < 0)
+ r = k;
+ }
sd_event_source_unref(event);
@@ -449,10 +454,15 @@ static int dispatch_raw_source_event(sd_event_source *event,
assert(source->buffer_event);
r = journal_remote_handle_raw_source(event, fd, EPOLLIN, journal_remote_server_global);
- if (r == 1)
+ if (r == 1) {
+ int k;
+
/* Might have more data. We need to rerun the handler
* until we are sure the buffer is exhausted. */
- sd_event_source_set_enabled(source->buffer_event, SD_EVENT_ON);
+ k = sd_event_source_set_enabled(source->buffer_event, SD_EVENT_ON);
+ if (k < 0)
+ r = k;
+ }
return r;
}