monitor: request-handler: Fix unreachable code when using request_server_init() 05/314805/1
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Jul 2024 09:43:23 +0000 (18:43 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Jul 2024 09:43:47 +0000 (18:43 +0900)
Fix unreachable code when using request_server_init() by returning the
error code if failed. Before this patch, the usage code of
request_server_init() is not able to receive the any error code.

Change-Id: Ibc525b758f730cc3be376b0628630d2095fea1ef
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/monitor/request-handler.c

index 182ac955f97cef32f02df4fe004c9c4038dd7b74..e1210b55d3e70d4e407219981b55ac9d4db20751 100644 (file)
@@ -1274,9 +1274,15 @@ error_out:
 
 int request_server_init(void)
 {
+       int ret;
+
        g_request_server_run = true;
-       if (create_daemon_thread(&g_server_thread, request_server_func, NULL))
+
+       ret = create_daemon_thread(&g_server_thread, request_server_func, NULL);
+       if (ret < 0) {
                _E("Failed to create request_server_thread ");
+               return ret;
+       }
 
        return 0;
 }