mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
device: Throw AlreadyInUse error if stopping an enroll during verification
When starting an enroll when verification is in progress (and vice-versa) we emit an AlreadyInUse error, however when calling VerifyStop() during an enrollment (and vice-versa) we just return a NoActionInProgress error, which is not the case. So let's be consistent and change the error type.
This commit is contained in:
committed by
Bastien Nocera
parent
154d0c0373
commit
b861500a9f
19
src/device.c
19
src/device.c
@ -960,6 +960,12 @@ static void fprint_device_verify_stop(FprintDevice *rdev,
|
||||
dbus_g_method_return_error(context, error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
} else if (priv->current_action == ACTION_ENROLL) {
|
||||
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
|
||||
"Enrollment in progress");
|
||||
dbus_g_method_return_error(context, error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (priv->current_cancellable) {
|
||||
@ -1213,8 +1219,17 @@ static void fprint_device_enroll_stop(FprintDevice *rdev,
|
||||
}
|
||||
|
||||
if (priv->current_action != ACTION_ENROLL) {
|
||||
g_set_error(&error, FPRINT_ERROR, FPRINT_ERROR_NO_ACTION_IN_PROGRESS,
|
||||
"No enrollment in progress");
|
||||
if (priv->current_action == ACTION_NONE) {
|
||||
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_NO_ACTION_IN_PROGRESS,
|
||||
"No enrollment in progress");
|
||||
} else if (priv->current_action == ACTION_VERIFY) {
|
||||
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
|
||||
"Verification in progress");
|
||||
} else if (priv->current_action == ACTION_IDENTIFY) {
|
||||
g_set_error (&error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE,
|
||||
"Identification in progress");
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
dbus_g_method_return_error(context, error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user