diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index 15d5514..8d8f89a 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -445,7 +445,7 @@ void InputHub::ScanInputDevices(const std::string& dirname) closedir(dir); } -void InputHub::CloseFd(int fd) +void InputHub::CloseFd(int& fd) { if (fd < 0) { DHLOGE("No fd need to be closed."); diff --git a/common/include/input_hub.h b/common/include/input_hub.h index d39b11d..24fb84e 100644 --- a/common/include/input_hub.h +++ b/common/include/input_hub.h @@ -121,7 +121,7 @@ private: Device* GetDeviceByPathLocked(const std::string& devicePath); Device* GetDeviceByFdLocked(int fd); Device* GetSupportDeviceByFd(int fd); - void CloseFd(int fd); + void CloseFd(int& fd); bool IsDeviceRegistered(const std::string& devicePath); bool ContainsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex);