]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode
authorMasatake YAMATO <yamato@redhat.com>
Thu, 22 Jun 2023 05:42:34 +0000 (14:42 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 22 Jun 2023 15:51:36 +0000 (00:51 +0900)
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 <yamato@redhat.com>
misc-utils/lsfd.c

index 5a5e37db6a2f03dbc3e409d1c94aff4fa6c5ec28..9f74862f15de11b069db210e06226fb524e3ae9d 100644 (file)
@@ -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?  "<string>":
+                       infos[i].json_type == SCOLS_JSON_ARRAY_STRING?  "<string>":
                        infos[i].json_type == SCOLS_JSON_NUMBER?  "<number>":
                        "<boolean>",
                        _(infos[i].help));