mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-26 10:03:40 +03:00
core: when looping over mount/swap names, continue if we find one which doesn't translate to a valid unit name
This commit is contained in:
parent
9d5acfab20
commit
598a6a8491
@ -1448,6 +1448,9 @@ int swap_process_device_new(Manager *m, sd_device *dev) {
|
||||
int q;
|
||||
|
||||
q = unit_name_from_path(devlink, ".swap", &n);
|
||||
if (IN_SET(q, -EINVAL, -ENAMETOOLONG)) /* If name too long or otherwise not convertible to
|
||||
* unit name, we can't manage it */
|
||||
continue;
|
||||
if (q < 0)
|
||||
return q;
|
||||
|
||||
|
@ -1473,16 +1473,17 @@ static int unit_add_mount_dependencies(Unit *u) {
|
||||
Unit *m;
|
||||
|
||||
r = unit_name_from_path(prefix, ".mount", &p);
|
||||
if (IN_SET(r, -EINVAL, -ENAMETOOLONG))
|
||||
continue; /* If the path cannot be converted to a mount unit name, then it's
|
||||
* not managable as a unit by systemd, and hence we don't need a
|
||||
* dependency on it. Let's thus silently ignore the issue. */
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
m = manager_get_unit(u->manager, p);
|
||||
if (!m) {
|
||||
/* Make sure to load the mount unit if
|
||||
* it exists. If so the dependencies
|
||||
* on this unit will be added later
|
||||
* during the loading of the mount
|
||||
* unit. */
|
||||
/* Make sure to load the mount unit if it exists. If so the dependencies on
|
||||
* this unit will be added later during the loading of the mount unit. */
|
||||
(void) manager_load_unit_prepare(u->manager, p, NULL, NULL, &m);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user