From 2d790b225d40d85a35319b71230f9a6a6c8b5db1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 13 Feb 2025 18:16:18 +0100 Subject: [PATCH] logind: map enum strings to underscores in logind Varlink doesn't know dashes in enums, we use them all the time. Convert dashes to underscores hence before we pass them through varlink. --- src/login/logind-varlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/login/logind-varlink.c b/src/login/logind-varlink.c index a757033a55f..23262fb9a5b 100644 --- a/src/login/logind-varlink.c +++ b/src/login/logind-varlink.c @@ -133,8 +133,8 @@ int session_send_create_reply_varlink(Session *s, const sd_bus_error *error) { SD_JSON_BUILD_PAIR_UNSIGNED("UID", s->user->user_record->uid), SD_JSON_BUILD_PAIR_CONDITION(!!s->seat, "Seat", SD_JSON_BUILD_STRING(s->seat ? s->seat->id : NULL)), SD_JSON_BUILD_PAIR_CONDITION(s->vtnr > 0, "VTNr", SD_JSON_BUILD_UNSIGNED(s->vtnr)), - SD_JSON_BUILD_PAIR_STRING("Class", session_class_to_string(s->class)), - SD_JSON_BUILD_PAIR_STRING("Type", session_type_to_string(s->type))); + SD_JSON_BUILD_PAIR("Class", JSON_BUILD_STRING_UNDERSCORIFY(session_class_to_string(s->class))), + SD_JSON_BUILD_PAIR("Type", JSON_BUILD_STRING_UNDERSCORIFY(session_type_to_string(s->type)))); } static JSON_DISPATCH_ENUM_DEFINE(json_dispatch_session_class, SessionClass, session_class_from_string); -- 2.47.3