From: Masatake YAMATO Date: Thu, 22 Jun 2023 05:42:34 +0000 (+0900) Subject: lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode X-Git-Tag: v2.39.1~20^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c289c152a3e956cdb3968903a5fe7e6adf8f4042;p=thirdparty%2Futil-linux.git lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode This is the backport-for-v2.39 version of #2328. With this change: { "lsfd": [ { "assoc": "3", "endpoints": [ "9942,test_mkfds,4-w", "9942,test_mkfds,5r-", "9942,test_mkfds,6-w" ] } ] } Without this change: { "lsfd": [ { "assoc": "3", "endpoints": [ "9942,test_mkfds,4-w\n9942,test_mkfds,5r-\n9942,test_mkfds,6-w" ] } ] } Signed-off-by: Masatake YAMATO --- diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index 5a5e37db6a..9f74862f15 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -145,7 +145,7 @@ static const struct colinfo infos[] = { 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING, N_("device type (blk, char, or nodev)") }, [COL_ENDPOINTS] = { "ENDPOINTS", - 0, SCOLS_FL_WRAP, SCOLS_JSON_STRING, + 0, SCOLS_FL_WRAP, SCOLS_JSON_ARRAY_STRING, N_("IPC endpoints information communicated with the fd") }, [COL_FLAGS] = { "FLAGS", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING, @@ -1561,6 +1561,7 @@ static void __attribute__((__noreturn__)) usage(void) for (i = 0; i < ARRAY_SIZE(infos); i++) fprintf(out, " %16s %-10s%s\n", infos[i].name, infos[i].json_type == SCOLS_JSON_STRING? "": + infos[i].json_type == SCOLS_JSON_ARRAY_STRING? "": infos[i].json_type == SCOLS_JSON_NUMBER? "": "", _(infos[i].help));