mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
main: Register the common name after initializing the manager
When creating the FprintManager object the devices will be enumerated. This operation calls the mainloop recursively. We do not want to receive any client requests before the initial enumeration has happened. Because of this, move the registration of the common name to happen after the enumeration has finished.
This commit is contained in:
28
src/main.c
28
src/main.c
@ -171,18 +171,6 @@ int main(int argc, char **argv)
|
|||||||
driver_proxy = dbus_g_proxy_new_for_name(fprintd_dbus_conn,
|
driver_proxy = dbus_g_proxy_new_for_name(fprintd_dbus_conn,
|
||||||
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
|
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
|
||||||
|
|
||||||
|
|
||||||
if (!org_freedesktop_DBus_request_name(driver_proxy, FPRINT_SERVICE_NAME,
|
|
||||||
0, &request_name_ret, &error)) {
|
|
||||||
g_warning("Failed to get name: %s", error->message);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
|
||||||
g_warning ("Got result code %u from requesting name", request_name_ret);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load the configuration file,
|
/* Load the configuration file,
|
||||||
* and the default storage plugin */
|
* and the default storage plugin */
|
||||||
if (!load_conf())
|
if (!load_conf())
|
||||||
@ -197,6 +185,22 @@ int main(int argc, char **argv)
|
|||||||
* all fprintd users */
|
* all fprintd users */
|
||||||
manager = fprint_manager_new(no_timeout);
|
manager = fprint_manager_new(no_timeout);
|
||||||
|
|
||||||
|
/* Obtain the well-known name after the manager has been initialized.
|
||||||
|
* Otherwise a client immediately enumerating the devices will not see
|
||||||
|
* any. */
|
||||||
|
if (!org_freedesktop_DBus_request_name(driver_proxy, FPRINT_SERVICE_NAME,
|
||||||
|
0, &request_name_ret, &error)) {
|
||||||
|
g_warning("Failed to get name: %s", error->message);
|
||||||
|
g_object_unref (manager);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
||||||
|
g_warning ("Got result code %u from requesting name", request_name_ret);
|
||||||
|
g_object_unref (manager);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
g_debug("D-Bus service launched with name: %s", FPRINT_SERVICE_NAME);
|
g_debug("D-Bus service launched with name: %s", FPRINT_SERVICE_NAME);
|
||||||
|
|
||||||
g_debug("entering main loop");
|
g_debug("entering main loop");
|
||||||
|
|||||||
Reference in New Issue
Block a user