summaryrefslogtreecommitdiff
path: root/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-27 22:40:10 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-27 22:40:10 +0100
commit957ca8908712d2a1c909472cb4581d228e89d4ad (patch)
tree7a6bd01476a97679dbe370eca74f2bfc9f4edecf /manager.c
parentc9b97d2a838899d00004fbfbd3f8c2e6932c89a0 (diff)
process only one epoll event at a time
if we ask for more than one from the kernel we might need to check for the validity of the ptr element since event might be processed after its ptr was already destructed.
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/manager.c b/manager.c
index f15cf79869..cd97e67da5 100644
--- a/manager.c
+++ b/manager.c
@@ -1084,12 +1084,12 @@ int manager_loop(Manager *m) {
assert(m);
for (;;) {
- struct epoll_event events[32];
- int n, i;
+ struct epoll_event event;
+ int n;
manager_dispatch_run_queue(m);
- if ((n = epoll_wait(m->epoll_fd, events, ELEMENTSOF(events), -1)) < 0) {
+ if ((n = epoll_wait(m->epoll_fd, &event, 1, -1)) < 0) {
if (errno == -EINTR)
continue;
@@ -1097,12 +1097,12 @@ int manager_loop(Manager *m) {
return -errno;
}
- for (i = 0; i < n; i++) {
- if ((r = process_event(m, events + i, &quit)) < 0)
- return r;
+ assert(n == 1);
- if (quit)
- return 0;
- }
+ if ((r = process_event(m, &event, &quit)) < 0)
+ return r;
+
+ if (quit)
+ return 0;
}
}