polkit: use -EBUSY to indicate shortcut after error or denial

Commit 536c18e5c3 ("bus-polkit: shortcut auth. after first denial")
added logic to async_polkit_query_check_action() that returns
-EALREADY when a failure or denial decision was made for a previous
action.

Tweak this to return -EBUSY instead of -EALREADY. This hopefully makes
the intent of the error more clear. EALREADY suggests that the request
is OK, but polkit is processing something else, and we should come back
later. EBUSY suggests that polkit is busy or unusable, hence the
request cannot be processed, and we should go away.
This commit is contained in:
Nick Rosbrook
2025-03-25 16:15:34 -04:00
parent bc3a11097f
commit 971fb3b0bc
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -2207,10 +2207,10 @@ static int verify_shutdown_creds(
&m->polkit_registry,
error);
if (r < 0) {
/* If we get -EALREADY, it means a polkit decision was made, but not for
/* If we get -EBUSY, it means a polkit decision was made, but not for
* this action in particular. Assuming we are blocked on inhibitors,
* ignore that error and allow the decision to be revealed below. */
if (blocked && r == -EALREADY)
if (blocked && r == -EBUSY)
error_or_denial = true;
else
return r;
@@ -3817,10 +3817,10 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error
&m->polkit_registry,
error);
if (r < 0) {
/* If we get -EALREADY, it means a polkit decision was made, but not for
/* If we get -EBUSY, it means a polkit decision was made, but not for
* this action in particular. Assuming there are more actions requested,
* ignore that error and allow the decision to be revealed later. */
if ((~v & w) && r == -EALREADY)
if ((~v & w) && r == -EBUSY)
error_or_denial = true;
else
return r;
+1 -1
View File
@@ -440,7 +440,7 @@ static int async_polkit_query_check_action(
/* Also deny if we've got an auth. failure for a previous action */
if (q->denied_action || q->error_action)
return -EALREADY;
return -EBUSY;
return 0; /* no reply yet */
}