summaryrefslogtreecommitdiff
path: root/ism
diff options
context:
space:
mode:
authorInHong Han <inhong1.han@samsung.com>2019-08-02 11:11:54 +0900
committerInHong Han <inhong1.han@samsung.com>2019-08-02 11:13:03 +0900
commit181d5d6c396d8a453c7c128c8ad47158a3249d89 (patch)
treee229d0800d48a216cad8e872906d7fa85b8af186 /ism
parentf27ecf3537d5e8a20055aa5e00bf7da8d9d9ad41 (diff)
downloadisf-181d5d6c396d8a453c7c128c8ad47158a3249d89.tar.gz
isf-181d5d6c396d8a453c7c128c8ad47158a3249d89.tar.bz2
isf-181d5d6c396d8a453c7c128c8ad47158a3249d89.zip
Fix signed integer overflow
runtime error: signed integer overflow: 1560934086 * 1000000 cannot be represented in type 'long int' Change-Id: I20e4ffbdde24f1d714982c1fd90260f629caa29c
Diffstat (limited to 'ism')
-rw-r--r--ism/src/scim_helper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/ism/src/scim_helper.cpp b/ism/src/scim_helper.cpp
index f3c60085..0f63b24e 100644
--- a/ism/src/scim_helper.cpp
+++ b/ism/src/scim_helper.cpp
@@ -874,9 +874,9 @@ HelperAgent::wait_for_message(int cmd, int timeout)
{
struct timeval t0 = { 0, 0 };
struct timeval t1 = { 0, 0 };
+ struct timeval t2 = { 0, 0 };
gettimeofday(&t0, NULL);
- int etime = 0;
do {
if (!m_impl->socket.is_connected() || !m_impl->recv.read_from_socket(m_impl->socket, timeout))
@@ -888,8 +888,8 @@ HelperAgent::wait_for_message(int cmd, int timeout)
}
gettimeofday(&t1, NULL);
- etime = ((t1.tv_sec * 1000000 + t1.tv_usec) - (t0.tv_sec * 1000000 + t0.tv_usec)) / 1000;
- } while (etime < timeout);
+ timersub(&t1, &t0, &t2);
+ } while (t2.tv_sec < timeout);
return false;
}