From 32ce17d193f4e529bc393dcedc69e77e389d5ea1 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Fri, 4 Jan 2013 16:45:28 +0100 Subject: changed close() method to take an l-value which is reset by it --- inputdev.cc | 7 ++++--- inputdev.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/inputdev.cc b/inputdev.cc index 4ddf6e1..30a15af 100644 --- a/inputdev.cc +++ b/inputdev.cc @@ -580,10 +580,12 @@ char const *cInputDeviceController::plugin_name(void) const return plugin_.Name(); } -void cInputDeviceController::close(int fd) +void cInputDeviceController::close(int &fd) { - if (fd != -1) + if (fd != -1) { ::close(fd); + fd = -1; + } } bool cInputDeviceController::open_generic(int fd_udev) @@ -980,6 +982,5 @@ void cInputDeviceController::stop(void) { Cancel(-1); this->close(fd_epoll_); - fd_epoll_ = -1; Cancel(5); } diff --git a/inputdev.h b/inputdev.h index 56ed0b8..7038442 100644 --- a/inputdev.h +++ b/inputdev.h @@ -65,7 +65,7 @@ public: void remove_device(char const *dev); void remove_device(class cInputDevice *dev); - static void close(int fd); + static void close(int &fd); bool Put(uint64_t Code, bool Repeat, bool Release) { return cRemote::Put(Code, Repeat, Release); -- cgit v1.2.3