sensord: check whether the data is valid or not 12/64512/1
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 22 Mar 2016 14:08:12 +0000 (23:08 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Fri, 1 Apr 2016 11:58:31 +0000 (20:58 +0900)
Change-Id: Ia456be16c90f949b1d32bbdc53579b41d58a477d
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/server/command_worker.cpp
src/server/sensor_event_poller.cpp

index b10071f..83e5bce 100644 (file)
@@ -712,6 +712,9 @@ bool command_worker::cmd_get_data(void *payload)
 
        remain_count = m_module->get_data(&data, &length);
 
+       if (remain_count < 0)
+               state = OP_ERROR;
+
        // In case of not getting sensor data, wait short time and retry again
        // 1. changing interval to be less than 10ms
        // 2. In case of first time, wait for INIT_WAIT_TIME
index 6058eed..082d689 100644 (file)
@@ -51,6 +51,9 @@ void sensor_event_poller::init_sensor_map()
 
                fd = sensor->get_poll_fd();
 
+               if (fd < 0)
+                       continue;
+
                m_fd_sensors.insert(std::make_pair(fd, sensor));
        }
 }