summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-23 11:02:13 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:29:53 +0200
commitfa82e6672499e2fb5a4191c567c6a418d1f88405 (patch)
tree07b09d02571162c0788885b8bb97d0dd1cb17e62 /process.c
parent687c9658628eb044be75df8074c5983e865b6394 (diff)
Fix the handling of processes without an owner
* main.c (argp_parser): New option --anonymous-owner. * main.h: Publish it. * process.c (process_lookup_pid): Use it to set the file owner uid of non-owned processes.
Diffstat (limited to 'process.c')
-rw-r--r--process.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/process.c b/process.c
index b2b098ff..7f5646ae 100644
--- a/process.c
+++ b/process.c
@@ -314,6 +314,7 @@ error_t
process_lookup_pid (struct ps_context *pc, pid_t pid, struct node **np)
{
struct proc_stat *ps;
+ int owner;
error_t err;
err = _proc_stat_create (pid, pc, &ps);
@@ -334,6 +335,7 @@ process_lookup_pid (struct ps_context *pc, pid_t pid, struct node **np)
if (! *np)
return ENOMEM;
- procfs_node_chown (*np, proc_stat_owner_uid (ps));
+ owner = proc_stat_owner_uid (ps);
+ procfs_node_chown (*np, owner >= 0 ? owner : opt_anon_owner);
return 0;
}