From: Karel Zak Date: Wed, 18 Apr 2018 13:12:46 +0000 (+0200) Subject: wipefs: use scols_column_set_json_type() X-Git-Tag: v2.33-rc1~300 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3571e1b976791d16a6442abf862e932c529b223;p=thirdparty%2Futil-linux.git wipefs: use scols_column_set_json_type() Signed-off-by: Karel Zak --- diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index c211d51430..76149d9fc2 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -163,11 +163,19 @@ static void init_output(struct wipe_control *ctl) for (i = 0; i < ncolumns; i++) { const struct colinfo *col = get_column_info(i); + struct libscols_column *cl; - if (!scols_table_new_column(tb, col->name, col->whint, - col->flags)) + cl = scols_table_new_column(tb, col->name, col->whint, + col->flags); + if (!cl) err(EXIT_FAILURE, _("failed to initialize output column")); + if (ctl->json) { + int id = get_column_id(i); + + if (id == COL_LEN) + scols_column_set_json_type(cl, SCOLS_JSON_NUMBER); + } } ctl->outtab = tb; }