From: Masatake YAMATO Date: Mon, 11 Oct 2021 21:27:58 +0000 (+0900) Subject: lsfd: fill UID column with the process's uid X-Git-Tag: v2.38-rc1~144^2~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35186bf0b1eec951814e6535897eb03860d04740;p=thirdparty%2Futil-linux.git 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 --- 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);