summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event/sd-event.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-17 01:15:09 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-06-17 09:13:48 +0200
commit366e641139130833a7354d9f2f96ce72633b1053 (patch)
tree6b5ff828a9f44e5542a4577b52480346ae1ee828 /src/libsystemd/sd-event/sd-event.c
parent3eb3228e583e7e07dc3f2d17ea02dcb06f30fcc0 (diff)
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal
If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be present in that given epoll-set. We actually track such state via our s->io.registered flag, so it better be true. Make sure if that's not true, we treat it similar to assert_return() (ie., print a loud warning).
Diffstat (limited to 'src/libsystemd/sd-event/sd-event.c')
-rw-r--r--src/libsystemd/sd-event/sd-event.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 00880c983b..76964aa0cc 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -468,24 +468,22 @@ static bool event_pid_changed(sd_event *e) {
return e->original_pid != getpid();
}
-static int source_io_unregister(sd_event_source *s) {
+static void source_io_unregister(sd_event_source *s) {
int r;
assert(s);
assert(s->type == SOURCE_IO);
if (event_pid_changed(s->event))
- return 0;
+ return;
if (!s->io.registered)
- return 0;
+ return;
r = epoll_ctl(s->event->epoll_fd, EPOLL_CTL_DEL, s->io.fd, NULL);
- if (r < 0)
- return -errno;
+ assert_log(r >= 0);
s->io.registered = false;
- return 0;
}
static int source_io_register(
@@ -1457,10 +1455,7 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) {
switch (s->type) {
case SOURCE_IO:
- r = source_io_unregister(s);
- if (r < 0)
- return r;
-
+ source_io_unregister(s);
s->enabled = m;
break;