revise code for unhandled cases 89/260289/1 accepted/tizen_6.5_unified accepted/tizen_7.0_unified_hotfix tizen_6.5 tizen_7.0_hotfix accepted/tizen/6.5/unified/20211028.101459 accepted/tizen/7.0/unified/20221110.060306 accepted/tizen/7.0/unified/hotfix/20221116.105245 accepted/tizen/unified/20210624.131826 submit/tizen/20210623.100758 submit/tizen_6.5/20211028.162201 tizen_6.5.m2_release tizen_7.0_m2_release
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 23 Jun 2021 07:10:25 +0000 (16:10 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 23 Jun 2021 07:10:25 +0000 (16:10 +0900)
Change-Id: I29fb6ceeca5da20428f252259612a58bae8eac79

src/agent/AgentMain.cpp
src/agent/AgentSocket.cpp

index eba8448..27b0fc1 100644 (file)
@@ -41,11 +41,15 @@ int main(int argc, char **argv)
        std::signal(SIGTERM, __on_signal);
        std::signal(SIGQUIT, __on_signal);
 
-       AgentDBus agentDBus;
-       AgentUtil agentUtil(agentDBus);
-       PluginLoader pluginLoader(agentUtil);
-       AgentSocket agentSocket(pluginLoader);
-
+       try {
+               AgentDBus agentDBus;
+               AgentUtil agentUtil(agentDBus);
+               PluginLoader pluginLoader(agentUtil);
+               AgentSocket agentSocket(pluginLoader);
+       } catch (...) {
+               _E("Initialization Fail");
+               return EXIT_FAILURE;
+       }
        sd_notify(0, "READY=1");
 
        __mainLoop.start();
index f9d6fb5..2277a16 100644 (file)
@@ -220,7 +220,7 @@ bool AgentSocket::__terminate()
        IF_FAIL_RETURN_TAG(strlen(path) < sizeof(addr.sun_path), false, _E, "Invalid path");
 
        sock = socket(AF_UNIX, SOCK_STREAM, 0);
-       IF_FAIL_RETURN_TAG(sock > 0, false, _E, "socket creation failed");
+       IF_FAIL_RETURN_TAG(sock != -1, false, _E, "socket creation failed");
 
        bzero(&addr, sizeof(addr));
        addr.sun_family = AF_UNIX;