]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-image: port to varlink_callbo_and_log()
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Jun 2025 11:18:45 +0000 (13:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Jun 2025 12:28:31 +0000 (14:28 +0200)
src/shared/dissect-image.c

index 34877ffa565c3b01af7f39ab740b1ed163d7a985..20afa421d150154b0eb5f37667bb8b4a954b6c90 100644 (file)
@@ -67,6 +67,7 @@
 #include "time-util.h"
 #include "udev-util.h"
 #include "user-util.h"
+#include "varlink-util.h"
 #include "xattr-util.h"
 
 /* how many times to wait for the device nodes to appear */
@@ -4586,7 +4587,7 @@ int mountfsd_mount_image(
         }
 
         sd_json_variant *reply = NULL;
-        r = sd_varlink_callbo(
+        r = varlink_callbo_and_log(
                         vl,
                         "io.systemd.MountFileSystem.MountImage",
                         &reply,
@@ -4598,9 +4599,7 @@ int mountfsd_mount_image(
                         SD_JSON_BUILD_PAIR_CONDITION(!!ps, "imagePolicy", SD_JSON_BUILD_STRING(ps)),
                         SD_JSON_BUILD_PAIR("allowInteractiveAuthentication", SD_JSON_BUILD_BOOLEAN(FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH))));
         if (r < 0)
-                return log_error_errno(r, "Failed to call MountImage() varlink call: %m");
-        if (!isempty(error_id))
-                return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to call MountImage() varlink call: %s", error_id);
+                return r;
 
         r = sd_json_dispatch(reply, dispatch_table, SD_JSON_ALLOW_EXTENSIONS, &p);
         if (r < 0)
@@ -4723,7 +4722,7 @@ int mountfsd_mount_directory(
 
         sd_json_variant *reply = NULL;
         const char *error_id = NULL;
-        r = sd_varlink_callbo(
+        r = varlink_callbo_and_log(
                         vl,
                         "io.systemd.MountFileSystem.MountDirectory",
                         &reply,
@@ -4735,9 +4734,7 @@ int mountfsd_mount_directory(
                                                           FLAGS_SET(flags, DISSECT_IMAGE_IDENTITY_UID) ? "identity" : "auto"),
                         SD_JSON_BUILD_PAIR_BOOLEAN("allowInteractiveAuthentication", FLAGS_SET(flags, DISSECT_IMAGE_ALLOW_INTERACTIVE_AUTH)));
         if (r < 0)
-                return log_error_errno(r, "Failed to call MountDirectory() varlink call: %m");
-        if (!isempty(error_id))
-                return log_error_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to call MountDirectory() varlink call: %s", error_id);
+                return r;
 
         static const sd_json_dispatch_field dispatch_table[] = {
                 { "mountFileDescriptor", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint, 0, SD_JSON_MANDATORY },