Don't close the fd if libinput_add_fd() fails
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 22 Aug 2014 04:54:06 +0000 (14:54 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 26 Aug 2014 01:04:42 +0000 (11:04 +1000)
commit0b26f2592cbe28f35b96a5422fda4bc6298930cb
tree0d5ad414bb8c5cf772e689c4bea01ac8ece1335f
parentc6478bbeeb6ecc328710f5777e4c4d7596dd6904
Don't close the fd if libinput_add_fd() fails

Let the caller decide what to do with the fd.

In the current code the caller can't know if the fd was closed on error since
we return NULL on malloc failure as well as on epoll_ctl() failure. In the
latter case the fd was closed, not in the former. The caller had to close
the fd anyway (and all three callers do), so drop closing the fd from this
function.

Found by Coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput.c