Fix bugs reported by Coverity and SVACE 78/280278/1 accepted/tizen_6.5_unified accepted/tizen/6.5/unified/20220902.125442 submit/tizen_6.5/20220901.095941
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 25 Aug 2022 08:33:05 +0000 (17:33 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Fri, 26 Aug 2022 05:34:25 +0000 (05:34 +0000)
Change-Id: I716175c16073e627a52a62176b2341c2b612953e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
(cherry picked from commit 936b3dfceec70f2a700c587d54aa2ac793a11991)

src/plugin/plugin.c

index 587fbd2..73d4990 100644 (file)
@@ -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: