From 0162d7f80bc1d2b442444a88995dfd66f5cda565 Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Thu, 25 Aug 2022 17:33:05 +0900 Subject: [PATCH] Fix bugs reported by Coverity and SVACE Change-Id: I716175c16073e627a52a62176b2341c2b612953e Signed-off-by: Unsung Lee (cherry picked from commit 936b3dfceec70f2a700c587d54aa2ac793a11991) --- src/plugin/plugin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugin/plugin.c b/src/plugin/plugin.c index 587fbd2..73d4990 100644 --- a/src/plugin/plugin.c +++ b/src/plugin/plugin.c @@ -238,7 +238,9 @@ API int resource_get_cpu_boosting_level (resource_pid_t pid, struct timeval tv; tv.tv_sec = 3; - setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(tv)); + tv.tv_usec = 0; + if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(tv)) < 0) + _E("[CPU-BOOSTING-PLUGIN] Failed to set timeout of receive (error = %m)"); memset(&output, 0, sizeof(output)); retry_header: -- 2.7.4