From 35186bf0b1eec951814e6535897eb03860d04740 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Tue, 12 Oct 2021 06:27:58 +0900 Subject: [PATCH] lsfd: fill UID column with the process's uid The original code fills the column with the owner id of the executable file. Because lsfd fills USER column field by decoding UID column, the USER in lsfd meant the owner name of the executable. On the other hand, lsof fills the USER column with the process's user name. To avoid users confusing, this change makes lsfd do the same lsof; filling UID column with the process's uid. Signed-off-by: Masatake YAMATO --- misc-utils/lsfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/misc-utils/lsfd.c b/misc-utils/lsfd.c index d586b55141..cf2a1497db 100644 --- a/misc-utils/lsfd.c +++ b/misc-utils/lsfd.c @@ -139,7 +139,7 @@ static struct colinfo infos[] = { [COL_TYPE] = { "TYPE", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING, N_("file type") }, [COL_UID] = { "UID", 0, SCOLS_FL_RIGHT, SCOLS_JSON_NUMBER, - N_("user ID number") }, + N_("user ID number of the process") }, [COL_USER] = { "USER", 0, SCOLS_FL_RIGHT, SCOLS_JSON_STRING, N_("user of the process") }, }; @@ -443,8 +443,6 @@ static struct file *collect_file_symlink(struct path_cxt *pc, file_init_content(f); - if (is_association(f, EXE)) - proc->uid = sb.st_uid; if (is_association(f, NS_MNT)) proc->ns_mnt = sb.st_ino; @@ -857,6 +855,7 @@ static void read_process(struct lsfd_control *ctl, struct path_cxt *pc, proc = new_process(pid, leader); proc->command = procfs_process_get_cmdname(pc, buf, sizeof(buf)) > 0 ? xstrdup(buf) : xstrdup(_("(unknown)")); + procfs_process_get_uid(pc, &proc->uid); collect_execve_file(pc, proc); -- 2.47.3