mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
systemctl: avoid crash when pattern expands to empty unit list
Fixes #19652.
This commit is contained in:
committed by
Yu Watanabe
parent
5709c7fe4e
commit
ffcd683852
@@ -526,6 +526,8 @@ int edit(int argc, char *argv[], void *userdata) {
|
||||
r = expand_unit_names(bus, strv_skip(argv, 1), NULL, &names, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to expand names: %m");
|
||||
if (strv_isempty(names))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "No units matched the specified patterns.");
|
||||
|
||||
STRV_FOREACH(tmp, names) {
|
||||
r = unit_is_masked(bus, &lp, *tmp);
|
||||
|
||||
Reference in New Issue
Block a user