sensord: add defensive code for blocking issue 36/125136/1
authorkibak.yoon <kibak.yoon@samsung.com>
Fri, 14 Apr 2017 03:24:47 +0000 (12:24 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 14 Apr 2017 03:24:47 +0000 (12:24 +0900)
- this issue is related to hrm_raw sensor device driver

Change-Id: Ib75c56b7847b4afe8aeb3a14609168a47a669b64
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/server/physical_sensor_handler.cpp

index 3ee22b7..85a5515 100644 (file)
@@ -75,11 +75,12 @@ int physical_sensor_handler::get_poll_fd(void)
 
 int physical_sensor_handler::read_fd(std::vector<uint32_t> &ids)
 {
+       retv_if(observer_count() == 0, OP_ERROR);
+       retv_if(!m_device, -EINVAL);
+
        int size;
        uint32_t *_ids;
 
-       retv_if(!m_device, -EINVAL);
-
        size = m_device->read_fd(&_ids);
        retv_if(size == 0, -ENODATA);