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;
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;
}