Skip to content

Commit

Permalink
sys-utils/lscpu: Change object type to SCOLS_JSON_STRING if data == "-"
Browse files Browse the repository at this point in the history
  • Loading branch information
echoechoin committed Feb 27, 2025
1 parent 467b0c1 commit 049901c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sys-utils/lscpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,13 @@ static void print_cpus_readable(struct lscpu_cxt *cxt, int cols[], size_t ncols)
err(EXIT_FAILURE, _("failed to allocate output line"));

for (c = 0; c < ncols; c++) {
struct libscols_column *cl;
data = get_cell_data(cxt, cpu, cols[c], buf, sizeof(buf));
if (!data || !*data)
if (!data || !*data) {
data = "-";
cl = scols_table_get_column(tb, c);
scols_column_set_json_type(cl, SCOLS_JSON_STRING);
}
if (scols_line_set_data(ln, c, data))
err(EXIT_FAILURE, _("failed to add output data"));
}
Expand Down

0 comments on commit 049901c

Please sign in to comment.