summaryrefslogtreecommitdiff
path: root/src/core/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/swap.c')
-rw-r--r--src/core/swap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index dc98f47387..b363c5ec09 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1242,10 +1242,14 @@ static void swap_shutdown(Manager *m) {
static int swap_enumerate(Manager *m) {
int r;
- struct epoll_event ev;
assert(m);
if (!m->proc_swaps) {
+ struct epoll_event ev = {
+ .events = EPOLLPRI,
+ .data.ptr = &m->swap_watch,
+ };
+
m->proc_swaps = fopen("/proc/swaps", "re");
if (!m->proc_swaps)
return (errno == ENOENT) ? 0 : -errno;
@@ -1253,10 +1257,6 @@ static int swap_enumerate(Manager *m) {
m->swap_watch.type = WATCH_SWAP;
m->swap_watch.fd = fileno(m->proc_swaps);
- zero(ev);
- ev.events = EPOLLPRI;
- ev.data.ptr = &m->swap_watch;
-
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->swap_watch.fd, &ev) < 0)
return -errno;
}