updatectl: fix unexpected polkit prompt on update
When running `updatectl update` since f0b2ea63, Install() was called
with the version resolved by Acquire() rather than the originally
requested (empty) version, causing the stricter update-to-version polkit
action to be used instead of the update polkit action.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
0ef9bf9723
commit
d3d142e5fd
@@ -75,6 +75,8 @@ typedef struct Operation {
|
||||
|
||||
/* Only used for Acquire()/Install() operations: */
|
||||
char *acquired_version;
|
||||
/* The version the user requested, possibly empty */
|
||||
char *requested_version;
|
||||
} Operation;
|
||||
|
||||
static Operation* operation_free(Operation *p) {
|
||||
@@ -90,6 +92,7 @@ static Operation* operation_free(Operation *p) {
|
||||
|
||||
free(p->job_path);
|
||||
free(p->acquired_version);
|
||||
free(p->requested_version);
|
||||
|
||||
sd_event_source_disable_unref(p->job_interrupt_source);
|
||||
sd_bus_slot_unref(p->job_properties_slot);
|
||||
@@ -1068,7 +1071,7 @@ static int update_acquire_finished(sd_bus_message *m, void *userdata, sd_bus_err
|
||||
update_install_started,
|
||||
op,
|
||||
"st",
|
||||
op->acquired_version,
|
||||
op->requested_version,
|
||||
0LU);
|
||||
if (r < 0)
|
||||
return log_bus_error(r, NULL, op->target_id, "call Install");
|
||||
@@ -1246,6 +1249,11 @@ static int do_update(sd_bus *bus, char **targets) {
|
||||
0LU);
|
||||
if (r < 0)
|
||||
return log_bus_error(r, NULL, targets[i], "call Acquire");
|
||||
|
||||
op->requested_version = strdup(versions[i]);
|
||||
if (!op->requested_version)
|
||||
return log_oom();
|
||||
|
||||
TAKE_PTR(op);
|
||||
|
||||
remaining++;
|
||||
|
||||
Reference in New Issue
Block a user