summaryrefslogtreecommitdiffstats
path: root/src/Daemon/Daemon.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-24 18:08:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-24 18:08:21 +0200
commitffb9d48d975cab3683bbbf9f94e0eacefcf4ce5b (patch)
tree1f6f1f8b0e74377c0c15e435bd4a3a027a87804b /src/Daemon/Daemon.cpp
parent18d048afff2d14a9c2b7bf0b64e973eda5b40954 (diff)
downloadabrt-ffb9d48d975cab3683bbbf9f94e0eacefcf4ce5b.tar.gz
abrt-ffb9d48d975cab3683bbbf9f94e0eacefcf4ce5b.tar.xz
abrt-ffb9d48d975cab3683bbbf9f94e0eacefcf4ce5b.zip
separate DBus::Glib::BusDispatcher creating from CommLayerServerDBus creation
it's technically wrong to do it that way. It was not biting us because we were creating just one object, but it was also ugly. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/Daemon.cpp')
-rw-r--r--src/Daemon/Daemon.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 47a963cf..81484d16 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -522,7 +522,6 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
int main(int argc, char** argv)
{
- GIOChannel* pGio;
int daemonize = 0;
signal(SIGTERM, handle_fatal_signal);
@@ -565,6 +564,7 @@ int main(int argc, char** argv)
xdup(0);
}
+ GIOChannel* pGio = NULL;
CCrashWatcher watcher;
/* Initialization */
@@ -592,6 +592,7 @@ int main(int argc, char** argv)
FindNewDumps(DEBUG_DUMPS_DIR);
/* (comment here) */
#ifdef ENABLE_DBUS
+ attach_dbus_dispatcher_to_glib_main_context();
g_pCommLayer = new CCommLayerServerDBus();
#elif ENABLE_SOCKET
g_pCommLayer = new CCommLayerServerSocket();
@@ -616,9 +617,11 @@ int main(int argc, char** argv)
catch (...)
{
/* Initialization error. Clean up, in reverse order */
+ error_msg("error while initializing daemon");
unlink(VAR_RUN_PIDFILE);
unlink(VAR_RUN_LOCK_FILE);
- g_io_channel_unref(pGio);
+ if (pGio)
+ g_io_channel_unref(pGio);
delete g_pCommLayer;
/* This restores /proc/sys/kernel/core_pattern, among other things: */
g_pPluginManager->UnLoadPlugins();
@@ -631,8 +634,8 @@ int main(int argc, char** argv)
}
/* Inform parent that initialization failed */
if (daemonize)
- kill(getppid(), SIGINT);
- error_msg_and_die("error while initializing daemon, exiting");
+ kill(getppid(), SIGINT);
+ error_msg_and_die("exiting");
}
/* Inform parent that we initialized ok */