From e82c6e8b6230b237c838f053d52baa3297668eaa Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 Jun 2021 15:49:10 +0200 Subject: [PATCH] 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. --- src/core/swap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/swap.c b/src/core/swap.c index fc781a3815b..8aecc391e7b 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -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) -- 2.47.3