From: dongshengyuan <545258830@qq.com> Date: Wed, 15 Jul 2026 08:41:15 +0000 (+0800) Subject: portablectl: normalize set-limit image paths X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f21e8206317371f4a29af795362c55a29903ef7b;p=thirdparty%2Fsystemd.git portablectl: normalize set-limit image paths Normalize the image argument for per-image SetImageLimit requests while leaving the single-argument pool limit mode unchanged. This aligns quota handling with other path-taking verbs. Reproducer: cd /tmp portablectl set-limit ./portable-repro 1G Before: ./portable-repro was sent unchanged to portabled and rejected as an invalid image name/path. Per-image quota changes worked for absolute paths but not for equivalent relative paths. Follow-up: 61d0578b07b97cbffebfd350bac481274e310d39 --- diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 27cc440437c..58eb6f37247 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -1468,6 +1468,7 @@ VERB(verb_set_limit, "set-limit", "[NAME|PATH] LIMIT", 2, 3, 0, static int verb_set_limit(int argc, char *argv[], uintptr_t _data, void *userdata) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; + _cleanup_free_ char *image = NULL; uint64_t limit; int r; @@ -1485,10 +1486,14 @@ static int verb_set_limit(int argc, char *argv[], uintptr_t _data, void *userdat return log_error_errno(r, "Failed to parse size: %s", argv[argc-1]); } - if (argc > 2) + if (argc > 2) { /* With two arguments changes the quota limit of the specified image */ - r = bus_call_method(bus, bus_portable_mgr, "SetImageLimit", &error, NULL, "st", argv[1], limit); - else + r = determine_image(argv[1], false, &image); + if (r < 0) + return r; + + r = bus_call_method(bus, bus_portable_mgr, "SetImageLimit", &error, NULL, "st", image, limit); + } else /* With one argument changes the pool quota limit */ r = bus_call_method(bus, bus_portable_mgr, "SetPoolLimit", &error, NULL, "t", limit);