ecore-drm: Fix failure of setting/closing evdev->fd which causes fd leak
authorDuna Oh <duna.oh@samsung.com>
Tue, 15 Dec 2015 15:02:49 +0000 (10:02 -0500)
committerChris Michael <cpmichael@osg.samsung.com>
Tue, 15 Dec 2015 15:28:39 +0000 (10:28 -0500)
commitcb23fd2af2d07c17ae2d6c08a7c87cf8abf45814
tree7c875da34053d84745c259ebd17e84fa260144fd
parent7fd907a1322ae251ca171f610dcaf06c700565e7
ecore-drm: Fix failure of setting/closing evdev->fd which causes fd leak

Summary:
When a input device is plugged in, _cb_open_restricted() is called before creating evdev.
So setting fd value on evdev was failed in _cb_open_restricted() and also closing evdev->fd was invalid.
Using a eina_hash which has 'path-fd' pairs, we can find fd value after evdev is created.

@fix

Test Plan:
(1) Multiple input devices are connected. Their evdev->fd remains zero or initial value.
(2) When one of those devices are plugged out, fd leak would happen.

Reviewers: raster, zmike, gwanglim, stefan_schmidt, devilhorns, ManMower

Subscribers: cedric, jpeg, Jeon, input.hacker

Differential Revision: https://phab.enlightenment.org/D3428
src/lib/ecore_drm/ecore_drm.c
src/lib/ecore_drm/ecore_drm_inputs.c
src/lib/ecore_drm/ecore_drm_launcher.c
src/lib/ecore_drm/ecore_drm_private.h