err(EXIT_FAILURE, _("failed to add output data"));
return true;
case COL_USER:
- add_uid(username_cache, (int)file->stat.st_uid);
+ add_uid(username_cache, (int)proc->uid);
if (scols_line_set_data(ln, column_index,
get_id(username_cache,
- (int)file->stat.st_uid)->name))
+ (int)proc->uid)->name))
err(EXIT_FAILURE, _("failed to add output data"));
return true;
case COL_FD:
xasprintf(&str, "%d", (int)proc->pid);
break;
case COL_UID:
- xasprintf(&str, "%d", (int)file->stat.st_uid);
+ xasprintf(&str, "%d", (int)proc->uid);
break;
case COL_SIZE:
xasprintf(&str, "%ju", file->stat.st_size);
return collect_file(&sb, sym, association);
}
+static void collect_proc_uid(struct proc *proc, int dd)
+{
+ struct stat sb;
+ if (fstat(dd, &sb) == 0)
+ proc->uid = sb.st_uid;
+}
+
static void collect_outofbox_files(struct proc *proc,
const char *proc_template,
enum association assocs[],
for (unsigned int i = 0; i < count; i++) {
struct file *file;
+ if (assocs[i] == ASSOC_EXE)
+ collect_proc_uid(proc, dd);
+
if ((file = collect_outofbox_file(dd,
assoc_names[assocs[i]],
assocs[i] * -1)) == NULL)