elput: Close fds when asked to
authorDerek Foreman <derekf@osg.samsung.com>
Tue, 25 Jul 2017 21:51:21 +0000 (16:51 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Tue, 25 Jul 2017 21:59:11 +0000 (16:59 -0500)
Our close callback tells logind we're done with a device, but it should
also actually close the fd it's passed, or we end up leaking piles of
fds on VC switch.

see weston commit 8f5acc2f3a29c3831af4ddd6bed57f703c98dc77
and subsequent regression in commit 72dea06d7952e3ce8dd8057f7106186da4fa2678
and pending fix in https://patchwork.freedesktop.org/patch/168992/

src/lib/elput/elput_logind.c

index 91eaffc..842de22 100644 (file)
@@ -649,6 +649,7 @@ _logind_close(Elput_Manager *em, int fd)
    int ret;
 
    ret = fstat(fd, &st);
+   close(fd);
    if (ret < 0) return;
 
    if (!S_ISCHR(st.st_mode)) return;