]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine: use sd_json_dispatch_signal() in varlink code
authorIvan Kruglov <mail@ikruglov.com>
Wed, 9 Oct 2024 11:35:58 +0000 (13:35 +0200)
committerIvan Kruglov <mail@ikruglov.com>
Thu, 10 Oct 2024 11:40:45 +0000 (13:40 +0200)
src/machine/machine-varlink.c

index 0f14e3063ab68b861181bdb3a5d4f30f8549b81e..f75f481e6e564b5cdaaa0d8928eec43e769bccaa 100644 (file)
@@ -332,7 +332,7 @@ int vl_method_kill(sd_varlink *link, sd_json_variant *parameters, sd_varlink_met
         static const sd_json_dispatch_field dispatch_table[] = {
                 VARLINK_DISPATCH_MACHINE_LOOKUP_FIELDS(struct params),
                 { "whom",   SD_JSON_VARIANT_STRING,         sd_json_dispatch_const_string, offsetof(struct params, swhom), 0 },
-                { "signal", _SD_JSON_VARIANT_TYPE_INVALID , sd_json_dispatch_int32,        offsetof(struct params, signo), SD_JSON_MANDATORY },
+                { "signal", _SD_JSON_VARIANT_TYPE_INVALID , sd_json_dispatch_signal,       offsetof(struct params, signo), SD_JSON_MANDATORY },
                 VARLINK_DISPATCH_POLKIT_FIELD,
                 {}
         };
@@ -364,9 +364,6 @@ int vl_method_kill(sd_varlink *link, sd_json_variant *parameters, sd_varlink_met
                         return sd_varlink_error_invalid_parameter_name(link, "whom");
         }
 
-        if (!SIGNAL_VALID(p.signo))
-                return sd_varlink_error_invalid_parameter_name(link, "signal");
-
         r = varlink_verify_polkit_async(
                         link,
                         manager->bus,