Merge pull request #562 from bebehei/buildsystem

Minor changes & fixes
This commit is contained in:
Nikos Tsipinakis 2018-11-22 18:02:06 +02:00 committed by GitHub
commit d786381cb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 21 deletions

View File

@ -58,7 +58,7 @@ debug: LDFLAGS += ${LDFLAGS_DEBUG}
debug: CPPFLAGS += ${CPPFLAGS_DEBUG} debug: CPPFLAGS += ${CPPFLAGS_DEBUG}
debug: all debug: all
.c.o: %.o: %.c
${CC} -o $@ -c $< ${CFLAGS} ${CC} -o $@ -c $< ${CFLAGS}
${OBJ}: config.mk ${OBJ}: config.mk

View File

@ -432,28 +432,33 @@ static void on_name_acquired(GDBusConnection *connection,
dbus_conn = connection; dbus_conn = connection;
} }
/* /**
* Get the PID of the current process, which acquired FDN DBus Name. * Get the PID of the current process, which acquired FDN DBus Name.
* *
* If name or vendor specified, the name and vendor * If name or vendor specified, the name and vendor
* will get additionally get via the FDN GetServerInformation method * will get additionally get via the FDN GetServerInformation method
* *
* Returns: valid PID, else -1 * @param connection The dbus connection
* @param pid The place to report the PID to
* @param name The place to report the name to, if not required set to NULL
* @param vendor The place to report the vendor to, if not required set to NULL
*
* @returns `true` on success, otherwise `false`
*/ */
static int dbus_get_fdn_daemon_info(GDBusConnection *connection, static bool dbus_get_fdn_daemon_info(GDBusConnection *connection,
int *pid,
char **name, char **name,
char **vendor) char **vendor)
{ {
g_return_val_if_fail(pid, false);
g_return_val_if_fail(connection, false);
char *owner = NULL; char *owner = NULL;
GError *error = NULL; GError *error = NULL;
int pid = -1;
GDBusProxy *proxy_fdn; GDBusProxy *proxy_fdn;
GDBusProxy *proxy_dbus; GDBusProxy *proxy_dbus;
if (!connection)
return pid;
proxy_fdn = g_dbus_proxy_new_sync( proxy_fdn = g_dbus_proxy_new_sync(
connection, connection,
/* do not trigger a start of the notification daemon */ /* do not trigger a start of the notification daemon */
@ -467,7 +472,7 @@ static int dbus_get_fdn_daemon_info(GDBusConnection *connection,
if (error) { if (error) {
g_error_free(error); g_error_free(error);
return pid; return false;
} }
GVariant *daemoninfo; GVariant *daemoninfo;
@ -505,7 +510,7 @@ static int dbus_get_fdn_daemon_info(GDBusConnection *connection,
if (error) { if (error) {
g_error_free(error); g_error_free(error);
return pid; return false;
} }
GVariant *pidinfo = g_dbus_proxy_call_sync( GVariant *pidinfo = g_dbus_proxy_call_sync(
@ -521,7 +526,7 @@ static int dbus_get_fdn_daemon_info(GDBusConnection *connection,
if (error) { if (error) {
g_error_free(error); g_error_free(error);
return pid; return false;
} }
g_variant_get(pidinfo, "(u)", &pid); g_variant_get(pidinfo, "(u)", &pid);
@ -534,7 +539,7 @@ static int dbus_get_fdn_daemon_info(GDBusConnection *connection,
if (pidinfo) if (pidinfo)
g_variant_unref(pidinfo); g_variant_unref(pidinfo);
return pid; return true;
} }
@ -543,9 +548,9 @@ static void on_name_lost(GDBusConnection *connection,
gpointer user_data) gpointer user_data)
{ {
if (connection) { if (connection) {
char *name = NULL; char *name;
int pid = dbus_get_fdn_daemon_info(connection, &name, NULL); int pid;
if (pid > 0) { if (dbus_get_fdn_daemon_info(connection, &pid, &name, NULL)) {
DIE("Cannot acquire '"FDN_NAME"': " DIE("Cannot acquire '"FDN_NAME"': "
"Name is acquired by '%s' with PID '%d'.", name, pid); "Name is acquired by '%s' with PID '%d'.", name, pid);
} else { } else {
@ -597,10 +602,6 @@ int dbus_init(void)
{ {
guint owner_id; guint owner_id;
#if !GLIB_CHECK_VERSION(2,35,0)
g_type_init();
#endif
introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, introspection_data = g_dbus_node_info_new_for_xml(introspection_xml,
NULL); NULL);