]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
portable: do not use SYNTHETIC_ERRNO for sd_bus_error_set_errno()
authorMike Yuan <me@yhndnzj.com>
Wed, 13 Nov 2024 16:45:53 +0000 (17:45 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 14 Nov 2024 13:12:13 +0000 (13:12 +0000)
The concept of synthetic errnos is about logging, which
is irrelevant irt bus error and we don't do any special
treatment in sd-bus for them, meaning the value propagated
would be spurious.

(cherry picked from commit 2f2058da0b88535cb3a95fc98e7b2f1ae4d35601)

src/portable/portable.c

index 1016b09d5afd6ca00967a6ffbe8e2bc84146f016..21c12d5d09a4c45e79e5be528a01f8ba8127cc17 100644 (file)
@@ -670,7 +670,7 @@ static int extract_image_and_extensions(
                 if (r < 0)
                         return r;
                 if (isempty(id))
-                        return sd_bus_error_set_errnof(error, SYNTHETIC_ERRNO(ESTALE), "Image %s os-release metadata lacks the ID field", name_or_path);
+                        return sd_bus_error_set_errnof(error, ESTALE, "Image %s os-release metadata lacks the ID field", name_or_path);
 
                 if (prefixes) {
                         valid_prefixes = strv_split(prefixes, WHITESPACE);
@@ -714,7 +714,7 @@ static int extract_image_and_extensions(
                                 r = extension_release_validate(ext->path, id, version_id, confext_level, "portable", extension_release, IMAGE_CONFEXT);
 
                         if (r == 0)
-                                return sd_bus_error_set_errnof(error, SYNTHETIC_ERRNO(ESTALE), "Image %s extension-release metadata does not match the root's", ext->path);
+                                return sd_bus_error_set_errnof(error, ESTALE, "Image %s extension-release metadata does not match the root's", ext->path);
                         if (r < 0)
                                 return sd_bus_error_set_errnof(error, r, "Failed to compare image %s extension-release metadata with the root's os-release: %m", ext->path);
                 }