]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: use \n as the separator in EVENTPOLL.TFDS column
authorMasatake YAMATO <yamato@redhat.com>
Sun, 18 Jun 2023 21:25:37 +0000 (06:25 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 22 Jun 2023 05:29:08 +0000 (14:29 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-unkn.c
tests/expected/lsfd/mkfds-eventpoll

index 0045a6a47209e2aa4f1bc71eecfa38bf6f2a8c8c..d76701ed0d191ceebd2ec9f5fbb9e4886818c2a8 100644 (file)
@@ -499,7 +499,8 @@ static void anon_eventpoll_attach_xinfo(struct unkn *unkn)
 }
 
 static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data,
-                                            const char *prefix)
+                                            const char *prefix,
+                                            const char sep)
 {
        char *str = prefix? xstrdup(prefix): NULL;
 
@@ -508,7 +509,7 @@ static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data,
                size_t offset = 0;
 
                if (i > 0) {
-                       buf[0] = ',';
+                       buf[0] = sep;
                        offset = 1;
                }
                snprintf(buf + offset, sizeof(buf) - offset, "%d", data->tfds[i]);
@@ -520,7 +521,7 @@ static char *anon_eventpoll_make_tfds_string(struct anon_eventpoll_data *data,
 static char *anon_eventpoll_get_name(struct unkn *unkn)
 {
        return anon_eventpoll_make_tfds_string((struct anon_eventpoll_data *)unkn->anon_data,
-                                              "tfds=");
+                                              "tfds=", ',');
 }
 
 static bool anon_eventpoll_fill_column(struct proc *proc  __attribute__((__unused__)),
@@ -534,7 +535,7 @@ static bool anon_eventpoll_fill_column(struct proc *proc  __attribute__((__unuse
 
        switch(column_id) {
        case COL_EVENTPOLL_TFDS:
-               *str =anon_eventpoll_make_tfds_string(data, NULL);
+               *str =anon_eventpoll_make_tfds_string(data, NULL, '\n');
                if (*str)
                        return true;
                break;
index e5f456e36c236b7ea80493e723754b563a33bd6d..1d5a69b5516e706e30570f8551803bbc7675d805 100644 (file)
@@ -1,2 +1,3 @@
-    3 eventpoll tfds=5,7 5,7
+    3 eventpoll tfds=5,7 5
+                         7
 ASSOC,TYPE,NAME,EVENTPOLL.TFDS: 0