aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-10-23 15:14:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-10-23 15:14:54 +0000
commit5ca4819ddf209124a8ffaad0f44d58cf6c77ec37 (patch)
tree57fba792ef7976f2978ea62c352da98e018bc872 /sys/kern/kern_exec.c
parent0deb032554242223e39ecac0b3663fa557ffdf71 (diff)
downloadsrc-5ca4819ddf209124a8ffaad0f44d58cf6c77ec37.tar.gz
src-5ca4819ddf209124a8ffaad0f44d58cf6c77ec37.zip
Notes
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 033f64122fcb..dce624d484b0 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -326,7 +326,7 @@ do_execve(td, args, mac_p)
struct ucred *newcred = NULL, *oldcred;
struct uidinfo *euip;
register_t *stack_base;
- int error, len = 0, i;
+ int error, i;
struct image_params image_params, *imgp;
struct vattr attr;
int (*img_first)(struct image_params *);
@@ -602,18 +602,12 @@ interpret:
execsigs(p);
/* name this process - nameiexec(p, ndp) */
- if (args->fname) {
- len = min(nd.ni_cnd.cn_namelen,MAXCOMLEN);
- bcopy(nd.ni_cnd.cn_nameptr, p->p_comm, len);
- } else {
- if (vn_commname(binvp, p->p_comm, MAXCOMLEN + 1) == 0)
- len = MAXCOMLEN;
- else {
- len = sizeof(fexecv_proc_title);
- bcopy(fexecv_proc_title, p->p_comm, len);
- }
- }
- p->p_comm[len] = 0;
+ bzero(p->p_comm, sizeof(p->p_comm));
+ if (args->fname)
+ bcopy(nd.ni_cnd.cn_nameptr, p->p_comm,
+ min(nd.ni_cnd.cn_namelen, MAXCOMLEN));
+ else if (vn_commname(binvp, p->p_comm, sizeof(p->p_comm)) != 0)
+ bcopy(fexecv_proc_title, p->p_comm, sizeof(fexecv_proc_title));
bcopy(p->p_comm, td->td_name, sizeof(td->td_name));
/*