From f4479119177f7453b46c6a2180d97f88c9cbe4af Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Mon, 2 Oct 2023 23:00:41 +0900 Subject: [PATCH] lsfd: call xinfo backend method before calling socket generic method when filling columns Signed-off-by: Masatake YAMATO --- misc-utils/lsfd-sock.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/misc-utils/lsfd-sock.c b/misc-utils/lsfd-sock.c index 7da2f61e58..ee0aa737a6 100644 --- a/misc-utils/lsfd-sock.c +++ b/misc-utils/lsfd-sock.c @@ -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)) -- 2.47.3