systemctl-clean-or-freeze: do not wait for units with --no-block

If --no-block is specified, the waiter is not allocated. But
bus_wait_for_units_run() was called unconditionally, and it asserts that
its argument is not NULL.

Only wait for the units when the waiter is allocated, as verb_kill()
does.
This commit is contained in:
Yu Watanabe committed 2026-11-04 08:17:14 +09:00
1 parent 07dbaa6ab0
commit 893d9cfb50
1 file changed
+7 -5
+7 -5
View File
@@ -95,11 +95,13 @@ int verb_clean_or_freeze(int argc, char *argv[], uintptr_t _data, void *userdata
}
}
r = bus_wait_for_units_run(w);
if (r < 0)
return log_error_errno(r, "Failed to wait for units: %m");
if (r == BUS_WAIT_FAILURE)
ret = EXIT_FAILURE;
if (w) {
r = bus_wait_for_units_run(w);
if (r < 0)
return log_error_errno(r, "Failed to wait for units: %m");
if (r == BUS_WAIT_FAILURE)
ret = EXIT_FAILURE;
}
return ret;
}