Fix the exceptions about dbus connection 47/65747/4 accepted/tizen/common/20160414.143054 accepted/tizen/ivi/20160415.014901 accepted/tizen/mobile/20160415.014929 accepted/tizen/tv/20160415.014912 accepted/tizen/wearable/20160415.014922 submit/tizen/20160414.081825
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 12 Apr 2016 09:09:26 +0000 (18:09 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 12 Apr 2016 10:16:27 +0000 (03:16 -0700)
Change-Id: Id5aabe9c7ee0407488291d69eb47876a437f88b0
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
inc/sigchild.h

index 8350550..6228662 100644 (file)
@@ -59,8 +59,14 @@ static inline int __send_app_dead_signal_dbus(int dead_pid)
        GError *err = NULL;
 
        /* send over session dbus for other applications */
-       if (bus == NULL)
-               return -1;
+       if (bus == NULL) {
+               bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+               if (bus == NULL) {
+                       _E("Failed to connect to the D-BUS daemon: %s", err->message);
+                       g_error_free(err);
+                       return -1;
+               }
+       }
 
        if (g_dbus_connection_emit_signal(bus,
                                        NULL,
@@ -91,8 +97,14 @@ static inline int __send_app_launch_signal_dbus(int launch_pid, const char *app_
 {
        GError *err = NULL;
 
-       if (bus == NULL)
-               return -1;
+       if (bus == NULL) {
+               bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+               if (bus == NULL) {
+                       _E("Failed to connect to the D-BUS daemon: %s", err->message);
+                       g_error_free(err);
+                       return -1;
+               }
+       }
 
        if (g_dbus_connection_emit_signal(bus,
                                        NULL,
@@ -132,7 +144,7 @@ static int __sigchild_action(pid_t dead_pid)
        unlink(buf);
 
        __socket_garbage_collector();
- end:
+end:
        return 0;
 }
 
@@ -164,7 +176,6 @@ static inline int __signal_init(void)
        if (!bus) {
                _E("Failed to connect to the D-BUS daemon: %s", error->message);
                g_error_free(error);
-               return -1;
        }
 
        for (i = 0; i < _NSIG; i++) {