Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern fix proc.pid.corename:



details:   https://anonhg.NetBSD.org/src/rev/127d947371d9
branches:  trunk
changeset: 765295:127d947371d9
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue May 24 01:19:48 2011 +0000

description:
fix proc.pid.corename:
- "oldp is not NULL" means the get case
- "newp is not NULL" means the set case
which may both happen at the same time.

diffstat:

 sys/kern/kern_resource.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 94ad1e24dfde -r 127d947371d9 sys/kern/kern_resource.c
--- a/sys/kern/kern_resource.c  Tue May 24 01:17:36 2011 +0000
+++ b/sys/kern/kern_resource.c  Tue May 24 01:19:48 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_resource.c,v 1.164 2011/05/14 17:57:05 rmind Exp $        */
+/*     $NetBSD: kern_resource.c,v 1.165 2011/05/24 01:19:48 mrg Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.164 2011/05/14 17:57:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.165 2011/05/24 01:19:48 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -825,7 +825,7 @@
 
        cnbuf = PNBUF_GET();
 
-       if (newp == NULL) {
+       if (oldp) {
                /* Get case: copy the core name into the buffer. */
                error = kauth_authorize_process(l->l_cred,
                    KAUTH_PROCESS_CORENAME, p,
@@ -837,7 +837,8 @@
                mutex_enter(&lim->pl_lock);
                strlcpy(cnbuf, lim->pl_corename, MAXPATHLEN);
                mutex_exit(&lim->pl_lock);
-       } else {
+       }
+       if (newp) {
                /* Set case: just use the temporary buffer. */
                error = kauth_authorize_process(l->l_cred,
                    KAUTH_PROCESS_CORENAME, p,



Home | Main Index | Thread Index | Old Index