From 15460eaed28b5353a94a17091d7795cfaeda9146 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 2 May 2014 14:14:58 +1000 Subject: systemd-logind: let the logind code decided whether to close an fd We can only request one fd per device from systemd-logind. If a fd is re-used by the same device, releasing the fd from one device doesn't mean we can close it. The systemd code knows when it's really released, so let it close the fd. Test case: xorg.conf section for an input device with hotplugging enabled. evdev detects the duplicate and closes the hotplugged device, which closes the fd. The other instance of evdev thinks the fd is still valid so now you're playing a double lottery. First, which client(s) will get the evdev fd? Second, which requests will be picked up by evdev and which ones will be picked up by the client? You'll never know, but the fun is in finding out. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- config/config.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/config.c b/config/config.c index def7f16ca..551451623 100644 --- a/config/config.c +++ b/config/config.c @@ -250,8 +250,6 @@ config_odev_free_attributes(struct OdevAttributes *attribs) free(iter); } - if (fd != -1) { - systemd_logind_release_fd(major, minor); - close(fd); - } + if (fd != -1) + systemd_logind_release_fd(major, minor, fd); } -- cgit v1.2.3