summaryrefslogtreecommitdiffstats
path: root/misc-utils/wipefs.c
diff options
context:
space:
mode:
authorKarel Zak2018-04-18 15:12:46 +0200
committerKarel Zak2018-04-18 15:12:46 +0200
commita3571e1b976791d16a6442abf862e932c529b223 (patch)
tree25d6a9d73ea1c77b980576b22c63b308a9c9b23a /misc-utils/wipefs.c
parentlslocks: use scols_column_set_json_type() (diff)
downloadkernel-qcow2-util-linux-a3571e1b976791d16a6442abf862e932c529b223.tar.gz
kernel-qcow2-util-linux-a3571e1b976791d16a6442abf862e932c529b223.tar.xz
kernel-qcow2-util-linux-a3571e1b976791d16a6442abf862e932c529b223.zip
wipefs: use scols_column_set_json_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/wipefs.c')
-rw-r--r--misc-utils/wipefs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index c211d5143..76149d9fc 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;
}