]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rfkill: use scols_column_set_json_type()
authorKarel Zak <kzak@redhat.com>
Wed, 18 Apr 2018 14:08:15 +0000 (16:08 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 18 Apr 2018 14:08:15 +0000 (16:08 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/rfkill.c

index 9c52fac3a098bb845d5f4cdecae5a6302f8e478e..57e1dddab02702956833144b5d0f7ce4fca23082 100644 (file)
@@ -462,9 +462,16 @@ static void rfkill_list_init(struct control *ctrl)
 
        for (i = 0; i < (size_t) ncolumns; i++) {
                const struct colinfo *col = get_column_info(i);
+               struct libscols_column *cl;
 
-               if (!scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags))
+               cl = scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags);
+               if (!cl)
                        err(EXIT_FAILURE, _("failed to allocate output column"));
+               if (ctrl->json) {
+                       int id = get_column_id(i);
+                       if (id == COL_ID)
+                               scols_column_set_json_type(cl, SCOLS_JSON_NUMBER);
+               }
        }
 }