PERFORCE change 122487 for review

John Baldwin jhb at freebsd.org
Sat Jun 30 00:54:21 UTC 2007


On Thursday 28 June 2007 09:01:45 am Roman Divacky wrote:
> http://perforce.freebsd.org/chv.cgi?CH=122487
> 
> Change 122487 by rdivacky at rdivacky_witten on 2007/06/28 13:01:09
> 
> 	Use vn_fullpath to get the name of the binary and stuff that into p_comm.
> 
> Affected files ...
> 
> .. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/kern_exec.c#6 edit
> 
> Differences ...
> 
> ==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/kern_exec.c#6 
(text+ko) ====
> 
> @@ -304,7 +304,7 @@
>  	struct ucred *newcred = NULL, *oldcred;
>  	struct uidinfo *euip;
>  	register_t *stack_base;
> -	int error, len, i;
> +	int error, len = 0, i;
>  	struct image_params image_params, *imgp;
>  	struct vattr attr;
>  	int (*img_first)(struct image_params *);
> @@ -560,8 +560,16 @@
>     		len = min(ndp->ni_cnd.cn_namelen,MAXCOMLEN);
>  		bcopy(ndp->ni_cnd.cn_nameptr, p->p_comm, len);
>  	} else {
> -	   	len = 10;
> -	   	bcopy("fexec neco", p->p_comm, 10);
> +		char	*freepath;
> +		char	*fullpath = NULL;
> +
> +		error = vn_fullpath(td, binvp, &fullpath, &freepath);
> +		if (error == 0) {
> +	   		len = min(strlen(fullpath), MAXCOMLEN);
> +	   		bcopy(fullpath, p->p_comm, len);
> +			if (freepath)
> +				free(freepath, M_TEMP);
> +			}
>  	}

What if vn_fullpath() fails?  What does p_comm[] contain then?

-- 
John Baldwin


More information about the p4-projects mailing list