1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-28 21:47:38 +03:00

pid1: don't choke on overly long device paths

This mimics what we do for device units: if there's a device we cannot
synthesize a good swap unit name for, then proceed without failure.
This commit is contained in:
Lennart Poettering 2021-06-02 15:49:10 +02:00
parent 6aeb8c89ba
commit e82c6e8b62

View File

@ -1426,13 +1426,14 @@ int swap_process_device_new(Manager *m, sd_device *dev) {
assert(m);
assert(dev);
r = sd_device_get_devname(dev, &dn);
if (r < 0)
if (sd_device_get_devname(dev, &dn) < 0)
return 0;
r = unit_name_from_path(dn, ".swap", &e);
if (r < 0)
return r;
if (r < 0) {
log_debug_errno(r, "Cannot convert device name '%s' to unit name, ignoring: %m", dn);
return 0;
}
u = manager_get_unit(m, e);
if (u)