device: Throw an error if we failed to delete a device storage print

Although this error is not fatal as the local print reference has been
properly removed.
This commit is contained in:
Marco Trevisan (Treviño)
2020-12-17 01:58:30 +01:00
parent 0f29cfc0c7
commit dbf01399ad
3 changed files with 19 additions and 0 deletions

View File

@ -1863,6 +1863,7 @@ delete_enrolled_fingers (FprintDevice *rdev,
FpFinger finger, FpFinger finger,
GError **error) GError **error)
{ {
g_autoptr(GError) device_error = NULL;
FprintDevicePrivate *priv = fprint_device_get_instance_private (rdev); FprintDevicePrivate *priv = fprint_device_get_instance_private (rdev);
guint i; guint i;
int r; int r;
@ -1910,6 +1911,14 @@ delete_enrolled_fingers (FprintDevice *rdev,
{ {
g_warning ("Error deleting print from device: %s", local_error->message); g_warning ("Error deleting print from device: %s", local_error->message);
g_warning ("This might indicate an issue in the libfprint driver or in the fingerprint device."); g_warning ("This might indicate an issue in the libfprint driver or in the fingerprint device.");
if (!device_error)
{
g_set_error (&device_error, FPRINT_ERROR,
FPRINT_ERROR_PRINTS_NOT_DELETED_FROM_DEVICE,
"Failed to delete print from device storage: %s",
local_error->message);
}
} }
} }
} }
@ -1956,6 +1965,13 @@ delete_enrolled_fingers (FprintDevice *rdev,
} }
} }
if (device_error)
{
/* This is a low priority error, higher priority errors would have returned failure already */
g_propagate_error (error, g_steal_pointer (&device_error));
return FALSE;
}
return TRUE; return TRUE;
} }

View File

@ -9,6 +9,7 @@
<!ENTITY ERROR_NO_ACTION_IN_PROGRESS "net.reactivated.Fprint.Error.NoActionInProgress"> <!ENTITY ERROR_NO_ACTION_IN_PROGRESS "net.reactivated.Fprint.Error.NoActionInProgress">
<!ENTITY ERROR_INVALID_FINGERNAME "net.reactivated.Fprint.Error.InvalidFingername"> <!ENTITY ERROR_INVALID_FINGERNAME "net.reactivated.Fprint.Error.InvalidFingername">
<!ENTITY ERROR_PRINTS_NOT_DELETED "net.reactivated.Fprint.Error.PrintsNotDeleted"> <!ENTITY ERROR_PRINTS_NOT_DELETED "net.reactivated.Fprint.Error.PrintsNotDeleted">
<!ENTITY ERROR_PRINTS_NOT_DELETED_FROM_DEVICE "net.reactivated.Fprint.Error.PrintsNotDeletedFromDevice">
]> ]>
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">

View File

@ -53,6 +53,8 @@ typedef enum {
FPRINT_ERROR_NO_SUCH_DEVICE, /*< nick=net.reactivated.Fprint.Error.NoSuchDevice >*/ FPRINT_ERROR_NO_SUCH_DEVICE, /*< nick=net.reactivated.Fprint.Error.NoSuchDevice >*/
/* Prints cannot be deleted from the fprintd storage */ /* Prints cannot be deleted from the fprintd storage */
FPRINT_ERROR_PRINTS_NOT_DELETED, /*< nick=net.reactivated.Fprint.Error.PrintsNotDeleted >*/ FPRINT_ERROR_PRINTS_NOT_DELETED, /*< nick=net.reactivated.Fprint.Error.PrintsNotDeleted >*/
/* Prints cannot be deleted from the device storage */
FPRINT_ERROR_PRINTS_NOT_DELETED_FROM_DEVICE, /*< nick=net.reactivated.Fprint.Error.PrintsNotDeletedFromDevice >*/
} FprintError; } FprintError;
/* Enum of possible permissions, orders and nick matter here: /* Enum of possible permissions, orders and nick matter here: