]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: call xinfo backend method before calling socket generic method when filling...
authorMasatake YAMATO <yamato@redhat.com>
Mon, 2 Oct 2023 14:00:41 +0000 (23:00 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Mon, 9 Oct 2023 06:37:35 +0000 (15:37 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-sock.c

index 7da2f61e589dbf326e59eb621de7932b2b008f3c..ee0aa737a65650ae5d0d74d205c86afb27967753 100644 (file)
@@ -55,6 +55,15 @@ static bool sock_fill_column(struct proc *proc __attribute__((__unused__)),
 {
        char *str = NULL;
        struct sock *sock = (struct sock *)file;
+
+       if (sock->xinfo && sock->xinfo->class
+           && sock->xinfo->class->fill_column) {
+               if (sock->xinfo->class->fill_column(proc, sock->xinfo, sock, ln,
+                                                   column_id, column_index,
+                                                   &str))
+                       goto out;
+       }
+
        switch(column_id) {
        case COL_TYPE:
                if (!sock->protoname)
@@ -112,16 +121,10 @@ static bool sock_fill_column(struct proc *proc __attribute__((__unused__)),
                              : "0");
                break;
        default:
-               if (sock->xinfo && sock->xinfo->class
-                   && sock->xinfo->class->fill_column) {
-                       if (sock->xinfo->class->fill_column(proc, sock->xinfo, sock, ln,
-                                                           column_id, column_index,
-                                                           &str))
-                               break;
-               }
                return false;
        }
 
+ out:
        if (!str)
                err(EXIT_FAILURE, _("failed to add output data"));
        if (scols_line_refer_data(ln, column_index, str))