Commit cbef9f19 authored by Marco Trevisan's avatar Marco Trevisan
Browse files

device: Propagate the error during deletion on bus

If a device with storage memory fails during deletion phase, we just ignore
it silently from the dbus-client POV, while we should instead propagate the
error to the client.
parent 4b7bdf48
......@@ -1300,13 +1300,14 @@ static void fprint_device_list_enrolled_fingers(FprintDevice *rdev,
dbus_g_method_return(context, g_ptr_array_free (ret, FALSE));
static void delete_enrolled_fingers(FprintDevice *rdev, const char *user)
gboolean delete_enrolled_fingers (FprintDevice *rdev,
const char *user,
GError **error)
FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev);
guint i;
/* First try deleting the print from the device, we don't consider it
* fatal if this does not work. */
if (fp_device_has_storage (priv->dev)) {
g_autoptr(GSList) prints = NULL;
GSList *l;
......@@ -1322,11 +1323,17 @@ static void delete_enrolled_fingers(FprintDevice *rdev, const char *user)
if (print) {
g_autoptr(GError) error = NULL;
if (!fp_device_delete_print_sync (priv->dev, print, NULL, &error)) {
g_warning ("Error deleting print from device: %s", error->message);
g_autoptr(GError) local_error = NULL;
if (!fp_device_delete_print_sync (priv->dev, print, NULL, &local_error)) {
g_set_error (error,
"Error deleting print from device: %s",
g_warning ("%s", (*error)->message);
g_warning ("This might indicate an issue in the libfprint driver or in the fingerprint device.");
return FALSE;
......@@ -1335,6 +1342,8 @@ static void delete_enrolled_fingers(FprintDevice *rdev, const char *user)
for (i = FP_FINGER_FIRST; i <= FP_FINGER_LAST; i++) {
store.print_data_delete(priv->dev, i, user);
return TRUE;
#ifdef __linux__
......@@ -1436,7 +1445,17 @@ static void fprint_device_delete_enrolled_fingers(FprintDevice *rdev,
delete_enrolled_fingers (rdev, user);
if (delete_enrolled_fingers (rdev, user, &error) == FALSE) {
g_free (user);
dbus_g_method_return_error (context, error);
g_clear_error (&error);
if (!fp_device_close_sync (priv->dev, NULL, &error)) {
g_warning("Error while closing device: %s", error->message);
g_error_free (error);
if (!opened && fp_device_has_storage (priv->dev)) {
if (!fp_device_close_sync (priv->dev, NULL, &error)) {
......@@ -1472,7 +1491,11 @@ static void fprint_device_delete_enrolled_fingers2(FprintDevice *rdev,
delete_enrolled_fingers (rdev, priv->session->username);
if (delete_enrolled_fingers (rdev, priv->session->username, &error) == FALSE) {
dbus_g_method_return_error (context, error);
g_error_free (error);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment