Index: kern_resource.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_resource.c,v retrieving revision 1.164 diff -p -u -r1.164 kern_resource.c --- kern_resource.c 14 May 2011 17:57:05 -0000 1.164 +++ kern_resource.c 17 May 2011 06:42:31 -0000 @@ -825,7 +825,7 @@ sysctl_proc_corename(SYSCTLFN_ARGS) 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 @@ sysctl_proc_corename(SYSCTLFN_ARGS) 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,