From a92b8e5f60a05c28571ef8344f0b9465f8804c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Dec 2020 18:23:36 +0100 Subject: [PATCH] device: Always return FALSE if setting an error in Check claimed We may have a case where the sender matches with the session's sender but have a session invocation already set. In such case we set an error, but still return TRUE. --- src/device.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/device.c b/src/device.c index 29dde1c..8f61744 100644 --- a/src/device.c +++ b/src/device.c @@ -473,7 +473,6 @@ _fprint_device_check_claimed (FprintDevice *rdev, FprintDevicePrivate *priv = fprint_device_get_instance_private(rdev); g_autoptr(SessionData) session = NULL; const char *sender; - gboolean retval; if (requested_state == STATE_IGNORED) return TRUE; @@ -501,14 +500,14 @@ _fprint_device_check_claimed (FprintDevice *rdev, } sender = g_dbus_method_invocation_get_sender (invocation); - retval = g_str_equal (sender, session->sender); - if (retval == FALSE || session->invocation != NULL) { + if (!g_str_equal (sender, session->sender) || session->invocation != NULL) { g_set_error (error, FPRINT_ERROR, FPRINT_ERROR_ALREADY_IN_USE, _("Device already in use by another user")); + return FALSE; } - return retval; + return TRUE; } static gboolean