diff options
Diffstat (limited to 'input/manager.c')
-rw-r--r-- | input/manager.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/input/manager.c b/input/manager.c index 41bafd20..f9c273fe 100644 --- a/input/manager.c +++ b/input/manager.c @@ -827,6 +827,7 @@ static DBusHandlerResult remove_device(DBusConnection *conn, DBusError derr; GSList *l; const char *path; + int err; dbus_error_init(&derr); if (!dbus_message_get_args(msg, &derr, @@ -845,14 +846,15 @@ static DBusHandlerResult remove_device(DBusConnection *conn, if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; - g_free(l->data); - device_paths = g_slist_remove(device_paths, l->data); - - if (input_device_unregister(conn, path) < 0) { + err = input_device_unregister(conn, path); + if (err < 0) { dbus_message_unref(reply); - return err_failed(conn, msg, "D-Bus path unregistration failed"); + return err_failed(conn, msg, strerror(-err)); } + g_free(l->data); + device_paths = g_slist_remove(device_paths, l->data); + return send_message_and_unref(conn, reply); } |