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

index c211d51430feef01da4655ae4511a6f16a9fb056..76149d9fc24cc643eda3976068f7adc70bee4bbd 100644 (file)
@@ -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;
 }