From: Karel Zak Date: Wed, 7 Mar 2012 12:11:54 +0000 (+0100) Subject: lsblk: remove (dm-N) from NAME for raw/pair output format X-Git-Tag: v2.22-rc1~711 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=205eb00283e18b414ffd86c6e20fbbe1ffeba685;p=thirdparty%2Futil-linux.git lsblk: remove (dm-N) from NAME for raw/pair output format $ lsblk -P -o NAME /dev/dm-0 NAME="luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)" the (dm-0) sucks in the parsable output... Reported-by: Peter Rajnoha Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index f33696a83f..52833d6747 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -478,9 +478,14 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line switch(id) { case COL_NAME: if (cxt->dm_name) { - snprintf(buf, sizeof(buf), "%s (%s)", + if ((lsblk->tt->flags & TT_FL_RAW) || + (lsblk->tt->flags & TT_FL_EXPORT)) + tt_line_set_data(ln, col, xstrdup(cxt->dm_name)); + else { + snprintf(buf, sizeof(buf), "%s (%s)", cxt->dm_name, cxt->name); - tt_line_set_data(ln, col, xstrdup(buf)); + tt_line_set_data(ln, col, xstrdup(buf)); + } break; } case COL_KNAME: