aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkremlin <ian@kremlin.cc>2014-06-05 12:18:53 +0800
committerkremlin <ian@kremlin.cc>2014-06-05 12:18:53 +0800
commit1cd91c9ccc0301e155901f137decbb0e1fcd93ea (patch)
tree4163e82848876210e64b8ff297b545f06063066f
parent15c779beb04802541e6b3ab0475243ca87674b75 (diff)
downloadsystembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar.gz
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar.bz2
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar.lz
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar.xz
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.tar.zst
systembsd-1cd91c9ccc0301e155901f137decbb0e1fcd93ea.zip
syncing between computers..
-rw-r--r--src/interfaces/hostnamed/hostnamed.c22
-rw-r--r--src/main.c6
2 files changed, 17 insertions, 11 deletions
diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c
index 1ce443e..0559b8b 100644
--- a/src/interfaces/hostnamed/hostnamed.c
+++ b/src/interfaces/hostnamed/hostnamed.c
@@ -1,6 +1,5 @@
#include <gio/gio.h>
-GMainLoop *loop;
GDBusNodeInfo *spect_data;
static void handle_method_call(GDBusConnection *conn,
@@ -12,9 +11,7 @@ static void handle_method_call(GDBusConnection *conn,
GDBusMethodInvocation *invc,
gpointer usrdat) {
- //g_printf("%s wants to call %s, at %s with interface %s\n", sender, method_name, obj_path, interf_name);
-
- if(g_strcmp0(method_name, "Introspect"
+ //if(g_strcmp0(method_name, "Introspect"
GVariant *xml_ret_gvar;
GString *xml_ret;
@@ -99,8 +96,8 @@ static void on_name_lost(GDBusConnection *conn,
gpointer user_data) {
g_print("lost name %s, exiting...\n", name);
- //g_print("you might need to run hacks/punch_config.sh\n");
- g_main_loop_quit(loop);
+ //TODO exit through g_main_loop properly...
+ exit(0);
}
/* safe call to try and start hostnamed */
@@ -108,8 +105,16 @@ GError * hostnamed_init() {
guint bus_descriptor;
GError *err = NULL;
+ gchar **hnd_ispect_xml;
+ GDir *cur_dir;
+ gchar *dir;
+
+ cur_dir = g_dir_open("./../", 0, err);
- spect_data = g_dbus_node_info_new_for_xml(SYSTEMD_HOSTNAMED_XML, &err);
+ g_sprintf(dir, "%s\n", g_dir_read_name(cur_dir));
+
+ //g_file_get_contents("../../../../conf/hostnamed-ispect.xml", hnd_ispect_xml, NULL, err);
+ //spect_data = g_dbus_node_info_new_for_xml(hnd_ispect_xml, &err);
bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM,
(gchar *)"org.freedesktop.hostname1",
@@ -120,9 +125,6 @@ GError * hostnamed_init() {
NULL,
NULL);
- loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(loop);
-
//TODO: malloc and return reference as if a main() closed
return err;
}
diff --git a/src/main.c b/src/main.c
index 42a4779..c19b489 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,7 +2,11 @@
#include "interfaces/hostnamed/hostnamed.c"
int main() {
- hostnamed_init();
+ GMainLoop *mloop = NULL;
+ mloop = g_main_loop_new(NULL, FALSE);
+ hostnamed_init();
+ g_main_loop_run(mloop);
+
return 0;
}