elput: Close fds when asked to

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/
This commit is contained in:
Derek Foreman 2017-07-25 16:51:21 -05:00
parent a5fc50c186
commit 69c6cbfdf1
1 changed files with 1 additions and 0 deletions

View 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;